[openrtm-commit:02836] r1050 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 9月 20日 (水) 16:47:58 JST
Author: t-katami
Date: 2017-09-20 16:47:58 +0900 (Wed, 20 Sep 2017)
New Revision: 1050
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
Log:
[compat,newfunc->releng_1_2] The slave manager confirms the existence of a master manager periodically.. refs #4188
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-15 07:54:45 UTC (rev 1049)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-20 07:47:58 UTC (rev 1050)
@@ -48,6 +48,8 @@
"corba.nameservers", "localhost",
"corba.master_manager", "localhost:2810",
"corba.nameservice.replace_endpoint", "NO",
+ "corba.update_master_manager.enable", "YES",
+ "corba.update_master_manager.interval", "10.0",
"exec_cxt.periodic.type", "jp.go.aist.rtm.RTC.executionContext.PeriodicExecutionContext",
"exec_cxt.periodic.rate", "1000",
"exec_cxt.sync_transition", "YES",
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-15 07:54:45 UTC (rev 1049)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-20 07:47:58 UTC (rev 1050)
@@ -3931,10 +3931,70 @@
if (m_config.getProperty("corba.endpoints_ipv4").equals("")) {
setEndpointProperty(m_mgrservant.getObjRef());
}
+ Properties prop = m_config.getNode("manager");
+ String[] names = prop.getProperty("naming_formats").split(",");
+
+ if(StringUtil.toBool(prop.getProperty("is_master"),
+ "YES", "NO", true)) {
+ for(int ic=0;ic<names.length;++ic){
+ String mgr_name = formatString(names[ic], prop);
+ m_namingManager.bindObject(mgr_name, m_mgrservant);
+ }
+ }
+ if(StringUtil.toBool(
+ m_config.getProperty("corba.update_master_manager.enable"),
+ "YES", "NO", true) &&
+ !StringUtil.toBool(
+ m_config.getProperty("manager.is_master"), "YES", "NO", false)
+ ) {
+ TimeValue tm = new TimeValue(10, 0);
+ if(m_config.findNode("corba.update_master_manager.interval")!=null){
+ String interval = m_config.getProperty(
+ "corba.update_master_manager.interval");
+ try{
+ double duration = Double.parseDouble(interval);
+ tm.convert(duration);
+ }
+ catch(Exception ex){
+ }
+ }
+ if(m_timer != null){
+ m_updateMasterManager
+ = new updateMasterManager(m_mgrservant);
+ m_timer.registerListenerObj(m_updateMasterManager,tm);
+ }
+ }
return true;
}
-
/**
+ * {@.ja タイマー処理用リスナー}
+ * {@.en Listener for timer processing}
+ */
+ updateMasterManager m_updateMasterManager;
+ /**
+ * {@.ja Manager の更新のためのリスナークラス}
+ * {@.en Listener Class for update of Manager}
+ */
+ class updateMasterManager implements CallbackFunction {
+ private ManagerServant m_mgrser;
+ /**
+ * {@.ja コンストラクタ}
+ * {@.en Constructor}
+ *
+ */
+ public updateMasterManager(ManagerServant mgrser) {
+ m_mgrser = mgrser;
+ }
+ /**
+ * {@.ja コールバックメソッド}
+ * {@.en Callback method}
+ */
+ public void doOperate() {
+ m_mgrser.update_master_manager();
+ }
+ }
+
+ /**
* {@.ja ManagerServantをバインドする。}
* {@.en Binds ManagerServant.}
*
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-15 07:54:45 UTC (rev 1049)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-20 07:47:58 UTC (rev 1050)
@@ -1511,7 +1511,6 @@
rtcout.println(Logbuf.DEBUG, "Invoking command: "+ cmd + ".");
try{
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.redirectErrorStream(true);
Process p = pb.start();
}
catch(Exception ex){
@@ -1735,7 +1734,68 @@
}
}
+ /**
+ * {@.ja マスターマネージャの有無を確認してリストを更新する}
+ * {@.en Confirms the presence of a master manager and renews a list.}
+ *
+ * void update_master_manager()
+ */
+ public void update_master_manager() {
+ rtcout.println(Logbuf.PARANOID,
+ "update_master_manager()");
+ if(!m_isMaster && m_objref!=null){
+ synchronized (m_masterMutex) {
+ if (m_masters.length > 0){
+ RTM.Manager m_masters[] = new RTM.Manager[0];
+ ArrayList<RTM.Manager> masters
+ = new ArrayList<RTM.Manager>();
+ for (int ic=0; ic < m_masters.length; ++ic) {
+ try{
+ if(m_masters[ic]._non_existent()){
+ }
+ else{
+ masters.add(m_masters[ic]);
+ }
+ }
+ catch(Exception ex){
+ String crlf = System.getProperty("line.separator");
+ rtcout.println(Logbuf.ERROR,
+ "Unknown exception cought."
+ + crlf
+ + ex.toString());
+ }
+ }
+ m_masters
+ = (RTM.Manager[])masters.toArray(new RTM.Manager[0]);
+ }
+ }
+ if (m_masters.length == 0){
+ try{
+ Properties config = m_mgr.getConfig();
+ RTM.Manager owner = findManager(
+ config.getProperty("corba.master_manager"));
+ if(owner != null){
+ rtcout.println(Logbuf.INFO,
+ "Master manager not found");
+ return;
+ }
+ add_master_manager(owner);
+ owner.add_slave_manager(m_objref);
+
+ return;
+ }
+ catch(Exception ex){
+ String crlf = System.getProperty("line.separator");
+ rtcout.println(Logbuf.ERROR,
+ "Unknown exception cought."
+ + crlf
+ + ex.toString());
+ }
+ }
+ }
+ }
+
/**
* <p></p>
*/
More information about the openrtm-commit
mailing list