[openrtm-commit:02813] r1038 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC: . executionContext

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 9月 7日 (木) 16:29:06 JST


Author: t-katami
Date: 2017-09-07 16:29:06 +0900 (Thu, 07 Sep 2017)
New Revision: 1038

Modified:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
Log:
[compat,bugfix,->releng_1_2] EC activation bug for multiple RTCs when they activated from participants RTCs. refs #3704

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2017-09-06 05:42:08 UTC (rev 1037)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java	2017-09-07 07:29:06 UTC (rev 1038)
@@ -920,13 +920,23 @@
     public ExecutionContext[] get_owned_contexts() throws SystemException {
 
         rtcout.println(Logbuf.TRACE, "RTObject_impl.get_owned_contexts()");
-
         ExecutionContextListHolder execlist;
         execlist = new ExecutionContextListHolder();
-        execlist.value = new ExecutionContext[0];
     
-        CORBA_SeqUtil.for_each(m_ecMine, new ec_copy(execlist));
-    
+        //CORBA_SeqUtil.for_each(m_ecMine, new ec_copy(execlist));
+        int len = m_ecMine.value.length;
+        ArrayList<ExecutionContextService> ecs_list 
+            = new ArrayList<ExecutionContextService>();
+        for(int ic=0; ic < len ; ++ic) {
+            ExecutionContextService ec_mine = m_ecMine.value[ic];
+
+            if (ec_mine != null) {
+                ecs_list.add(ec_mine);
+            }
+        }
+        execlist.value = new ExecutionContext[ecs_list.size()];
+        execlist.value = (ExecutionContext[])ecs_list.toArray(new ExecutionContext[0]);
+         
         return execlist.value;
      }
 
@@ -2576,7 +2586,19 @@
 
         rtcout.println(Logbuf.TRACE, "RTObject_impl.setProperties()");
 
+        {
+            rtcout.println(Logbuf.PARANOID, "prop:");
+            String str = new String();
+            str = prop._dump(str,prop,0);
+            rtcout.println(Logbuf.DEBUG, str);
+        }
         m_properties.merge(prop);
+        {
+            rtcout.println(Logbuf.PARANOID, "m_properties:");
+            String str = new String();
+            str = m_properties._dump(str,m_properties,0);
+            rtcout.println(Logbuf.DEBUG, str);
+        }
         try {
             syncAttributesByProperties();
         } catch (Exception ex) {
@@ -3051,7 +3073,26 @@
 
         String propkey = "port.inport.";
         propkey += name;
+        {
+            rtcout.println(Logbuf.PARANOID, "addInPort::m_properties:");
+            String str = new String();
+            str = m_properties._dump(str,m_properties,0);
+            rtcout.println(Logbuf.DEBUG, str);
+        }
+        {
+            rtcout.println(Logbuf.PARANOID, "addInPort::port.inport.dataport:");
+            String str = new String();
+            Properties prop = m_properties.getNode("port.inport.dataport");
+            str = prop._dump(str,prop,0);
+            rtcout.println(Logbuf.DEBUG, str);
+        }
         m_properties.getNode(propkey).merge(m_properties.getNode("port.inport.dataport"));
+        {
+            rtcout.println(Logbuf.PARANOID, "addInPort::m_properties2:");
+            String str = new String();
+            str = m_properties._dump(str,m_properties,0);
+            rtcout.println(Logbuf.DEBUG, str);
+        }
 
         boolean ret = addPort(inport);
     

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java	2017-09-06 05:42:08 UTC (rev 1037)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java	2017-09-07 07:29:06 UTC (rev 1038)
@@ -442,6 +442,9 @@
             return ReturnCode_t.RTC_ERROR;
         }
         rtcout.println(Logbuf.DEBUG, "addComponent() succeeded.");
+        if (m_running==false) {
+            updateComponentList();
+        }
         return ReturnCode_t.RTC_OK;
     }
 
@@ -527,9 +530,13 @@
             synchronized (m_removedMutex){
                 m_removedComps.add(rtobj);
 
-                return ReturnCode_t.RTC_OK;
+                //return ReturnCode_t.RTC_OK;
             }
         }
+        if (m_running==false) {
+            updateComponentList();
+        }
+        return ReturnCode_t.RTC_OK;
     }
     public RTObjectStateMachine findComponent(LightweightRTObject comp) {
         for (int ic=0; ic < m_comps.size() ; ++ic) {

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java	2017-09-06 05:42:08 UTC (rev 1037)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java	2017-09-07 07:29:06 UTC (rev 1038)
@@ -318,6 +318,11 @@
     }
     public ReturnCode_t onAddedComponent(LightweightRTObject rtobj)
     {
+        synchronized (m_workerthread.mutex_) {
+            if(m_workerthread.running_ == false) {
+                m_worker.updateComponentList();
+            }
+        }
         return ReturnCode_t.RTC_OK;
     }
     public ReturnCode_t onRemovingComponent(LightweightRTObject rtobj)
@@ -326,6 +331,11 @@
     }
     public ReturnCode_t onRemovedComponent(LightweightRTObject rtobj)
     {
+        synchronized (m_workerthread.mutex_) {
+            if(m_workerthread.running_ == false) {
+                m_worker.updateComponentList();
+            }
+        }
         return ReturnCode_t.RTC_OK;
     }
 
@@ -612,7 +622,8 @@
     }
     public ReturnCode_t activateComponent(LightweightRTObject comp) {
 
-        rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.activateComponent()");
+        rtcout.println(Logbuf.TRACE, 
+                       "PeriodicExecutionContext.activateComponent()");
         ReturnCode_t ret = onActivating(comp); // Template
         if (ret != ReturnCode_t.RTC_OK)
         {



More information about the openrtm-commit mailing list