[openrtm-commit:02766] r1025 - in branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: Extension/LocalService/nameservice_file RTMExamples/AutoTest RTMExamples/ExtTrigger RTMExamples/SeqIO RTMExamples/SeqIO/view RTMExamples/SimpleIO RTMExamples/SimpleService RTMExamples/TopicTest jp/go/aist/rtm/RTC jp/go/aist/rtm/RTC/SDOPackage jp/go/aist/rtm/RTC/buffer jp/go/aist/rtm/RTC/executionContext jp/go/aist/rtm/RTC/port jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 8月 25日 (金) 17:06:24 JST
Author: t-katami
Date: 2017-08-25 17:06:24 +0900 (Fri, 25 Aug 2017)
New Revision: 1025
Modified:
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/Extension/LocalService/nameservice_file/FileNameservice.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/AutoTest/MyServiceSVC_impl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOutImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOutImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConsoleInImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ConfigAdmin.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/buffer/RingBuffer.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicECOrganization.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortSHMConsumer.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortSHMConsumer.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/NVUtil.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java
Log:
[merge] r985-1006 have been merged from trunk
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/Extension/LocalService/nameservice_file/FileNameservice.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/Extension/LocalService/nameservice_file/FileNameservice.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/Extension/LocalService/nameservice_file/FileNameservice.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -279,7 +279,7 @@
if (fs.equals("flat")) {
rtcout.println(Logbuf.DEBUG,"file_structure = flat");
String d = m_profile.properties.getProperty("context_delimiter");
- ns_path.replaceAll(file_separator, d);
+ ns_path = ns_path.replaceAll(file_separator, d);
pathstring += ns_path;
}
else if (fs.equals("tree")) {
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/AutoTest/MyServiceSVC_impl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/AutoTest/MyServiceSVC_impl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/AutoTest/MyServiceSVC_impl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -31,7 +31,8 @@
public String[] get_echo_history() {
// Please insert your code here and remove the following warning pragma
// TODO "Code missing in function <EchoList get_echo_history()>"
- return null;
+ String[] ret = {""};
+ return ret;
}
public void set_value(float value) {
@@ -48,7 +49,8 @@
public float[] get_value_history() {
// Please insert your code here and remove the following warning pragma
// TODO "Code missing in function <ValueList get_value_history()>"
- return null;
+ float[] ret = {};
+ return ret;
}
public String get_echo_message() {
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -75,6 +75,10 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
CorbaConsumer<DataFlowComponent> conin
= new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
@@ -87,6 +91,10 @@
PortServiceListHolder pout = new PortServiceListHolder();
pout.value = new PortService[0];
+ if((conin == null) || (conout == null)){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleIn0 component
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
@@ -185,13 +193,15 @@
} catch (IOException e) {
e.printStackTrace();
}
- if( cmd.equals("0") ) {
- ec0Ref.tick();
- } else if( cmd.equals("1") ) {
- ec1Ref.tick();
- } else if( cmd.equals("2") ) {
- ec0Ref.tick();
- ec1Ref.tick();
+ if(cmd != null){
+ if( cmd.equals("0") ) {
+ ec0Ref.tick();
+ } else if( cmd.equals("1") ) {
+ ec1Ref.tick();
+ } else if( cmd.equals("2") ) {
+ ec0Ref.tick();
+ ec1Ref.tick();
+ }
}
} catch(Exception ex) {
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -98,10 +98,13 @@
protected ReturnCode_t onExecute(int ec_id) {
// m_count++;
// System.out.println("Please input number: " + m_count);
- System.out.println("Please input number: ");
+ System.out.print("Please input number: ");
BufferedReader buff = new BufferedReader(new InputStreamReader( System.in ));
try {
- m_out.data = Integer.parseInt(buff.readLine());
+ String str = buff.readLine();
+ if(str != null){
+ m_out.data = Integer.parseInt(str);
+ }
} catch (NumberFormatException e) {
System.out.println("Input number Error!");
// e.printStackTrace();
@@ -112,7 +115,7 @@
System.out.println("Sending to subscriber: " + m_out.data);
m_outOut.write();
- return ReturnCode_t.RTC_OK;
+ return super.onExecute(ec_id);
}
//
// The aborting action when main logic error occurred.
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOutImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOutImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleOutImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -102,7 +102,7 @@
e.printStackTrace();
}
- return ReturnCode_t.RTC_OK;
+ return super.onExecute(ec_id);
}
//
// The aborting action when main logic error occurred.
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOutImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOutImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/SeqOutImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -159,9 +159,9 @@
// former rtc_active_do()
@Override
protected ReturnCode_t onExecute(int ec_id) {
- m_Octet.v.data = (byte)(Math.random() * Byte.MAX_VALUE - Byte.MAX_VALUE/2);
- m_Short.v.data = (short)(Math.random() * Short.MAX_VALUE - Short.MAX_VALUE/2);
- m_Long.v.data = (int)(Math.random() * Integer.MAX_VALUE - Integer.MAX_VALUE/2);
+ m_Octet.v.data = (byte)(Math.random() * (double)Byte.MAX_VALUE - (double)Byte.MAX_VALUE/2);
+ m_Short.v.data = (short)(Math.random() * (double)Short.MAX_VALUE - (double)Short.MAX_VALUE/2);
+ m_Long.v.data = (int)(Math.random() * (double)Integer.MAX_VALUE - (double)Integer.MAX_VALUE/2);
m_Float.v.data = (float)(Math.random() * Float.MAX_VALUE) - Float.MAX_VALUE/2;
m_Double.v.data = Math.random() * Double.MAX_VALUE - Double.MAX_VALUE/2;
@@ -168,9 +168,9 @@
for( int intIdx=0;intIdx<10;++intIdx ) {
m_DoubleSeq.v.data[intIdx] = Math.random() * Double.MAX_VALUE - Double.MAX_VALUE/2;
m_FloatSeq.v.data[intIdx] = (float)(Math.random() * Float.MAX_VALUE) - Float.MAX_VALUE/2;
- m_LongSeq.v.data[intIdx] = (int)(Math.random() * Integer.MAX_VALUE - Integer.MAX_VALUE/2);
- m_ShortSeq.v.data[intIdx] = (short)(Math.random() * Short.MAX_VALUE - Short.MAX_VALUE/2);
- m_OctetSeq.v.data[intIdx] = (byte)(Math.random() * Byte.MAX_VALUE - Byte.MAX_VALUE/2);
+ m_LongSeq.v.data[intIdx] = (int)(Math.random() * (double)Integer.MAX_VALUE - (double)Integer.MAX_VALUE/2);
+ m_ShortSeq.v.data[intIdx] = (short)(Math.random() * (double)Short.MAX_VALUE - (double)Short.MAX_VALUE/2);
+ m_OctetSeq.v.data[intIdx] = (byte)(Math.random() * (double)Byte.MAX_VALUE - (double)Byte.MAX_VALUE/2);
}
m_DoubleOut.write();
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -89,36 +89,56 @@
synchronized (this) {
- if (_octetValMarked) {
- _view.setOctetVal(_octetVal);
+ synchronized (_octetValMarked_mutex) {
+ if (_octetValMarked) {
+ _view.setOctetVal(_octetVal);
+ }
}
- if (_shortValMarked) {
- _view.setShortVal(_shortVal);
+ synchronized (_shortValMarked_mutex) {
+ if (_shortValMarked) {
+ _view.setShortVal(_shortVal);
+ }
}
- if (_longValMarked) {
- _view.setLongVal(_longVal);
+ synchronized (_longValMarked_mutex) {
+ if (_longValMarked) {
+ _view.setLongVal(_longVal);
+ }
}
- if (_floatValMarked) {
- _view.setFloatVal(_floatVal);
+ synchronized (_floatValMarked_mutex) {
+ if (_floatValMarked) {
+ _view.setFloatVal(_floatVal);
+ }
}
- if (_doubleValMarked) {
- _view.setDoubleVal(_doubleVal);
+ synchronized (_doubleValMarked_mutex) {
+ if (_doubleValMarked) {
+ _view.setDoubleVal(_doubleVal);
+ }
}
- if (_octetSeqVal != null) {
- _view.setOctetSeqVal(_octetSeqVal);
+ synchronized (_octetSeqVal_mutex) {
+ if (_octetSeqVal != null) {
+ _view.setOctetSeqVal(_octetSeqVal);
+ }
}
- if (_shortSeqVal != null) {
- _view.setShortSeqVal(_shortSeqVal);
+ synchronized (_shortSeqVal_mutex) {
+ if (_shortSeqVal != null) {
+ _view.setShortSeqVal(_shortSeqVal);
+ }
}
- if (_longSeqVal != null) {
- _view.setLongSeqVal(_longSeqVal);
+ synchronized (_longSeqVal_mutex) {
+ if (_longSeqVal != null) {
+ _view.setLongSeqVal(_longSeqVal);
+ }
}
- if (_floatSeqVal != null) {
- _view.setFloatSeqVal(_floatSeqVal);
+ synchronized (_floatSeqVal_mutex) {
+ if (_floatSeqVal != null) {
+ _view.setFloatSeqVal(_floatSeqVal);
+ }
}
- if (_doubleSeqVal != null) {
- _view.setDoubleSeqVal(_doubleSeqVal);
+ synchronized (_doubleSeqVal_mutex) {
+ if (_doubleSeqVal != null) {
+ _view.setDoubleSeqVal(_doubleSeqVal);
+ }
}
reset();
@@ -127,7 +147,9 @@
synchronized public void setOctetVal(byte value) {
- _octetValMarked = true;
+ synchronized (_octetValMarked_mutex) {
+ _octetValMarked = true;
+ }
_octetVal = value;
registInvoker();
}
@@ -134,7 +156,9 @@
synchronized public void setShortVal(short value) {
- _shortValMarked = true;
+ synchronized (_shortValMarked_mutex) {
+ _shortValMarked = true;
+ }
_shortVal = value;
registInvoker();
}
@@ -141,7 +165,9 @@
synchronized public void setLongVal(int value) {
- _longValMarked = true;
+ synchronized (_longValMarked_mutex) {
+ _longValMarked = true;
+ }
_longVal = value;
registInvoker();
}
@@ -148,7 +174,9 @@
synchronized public void setFloatVal(float value) {
- _floatValMarked = true;
+ synchronized (_floatValMarked_mutex) {
+ _floatValMarked = true;
+ }
_floatVal = value;
registInvoker();
}
@@ -155,7 +183,9 @@
synchronized public void setDoubleVal(double value) {
- _doubleValMarked = true;
+ synchronized (_doubleValMarked_mutex) {
+ _doubleValMarked = true;
+ }
_doubleVal = value;
registInvoker();
}
@@ -162,47 +192,77 @@
synchronized public void setOctetSeqVal(byte[] values) {
- _octetSeqVal = values;
+ synchronized (_octetSeqVal_mutex) {
+ _octetSeqVal = values;
+ }
registInvoker();
}
synchronized public void setShortSeqVal(short[] values) {
- _shortSeqVal = values;
+ synchronized (_shortSeqVal_mutex) {
+ _shortSeqVal = values;
+ }
registInvoker();
}
synchronized public void setLongSeqVal(int[] values) {
- _longSeqVal = values;
+ synchronized (_longSeqVal_mutex) {
+ _longSeqVal = values;
+ }
registInvoker();
}
synchronized public void setFloatSeqVal(float[] values) {
- _floatSeqVal = values;
+ synchronized (_floatSeqVal_mutex) {
+ _floatSeqVal = values;
+ }
registInvoker();
}
synchronized public void setDoubleSeqVal(double[] values) {
- _doubleSeqVal = values;
+ synchronized (_doubleSeqVal_mutex) {
+ _doubleSeqVal = values;
+ }
registInvoker();
}
private void reset() {
- _octetValMarked = false;
- _shortValMarked = false;
- _longValMarked = false;
- _floatValMarked = false;
- _doubleValMarked = false;
- _octetSeqVal = null;
- _shortSeqVal = null;
- _longSeqVal = null;
- _floatSeqVal = null;
- _doubleSeqVal = null;
+ synchronized (_octetValMarked_mutex) {
+ _octetValMarked = false;
+ }
+ synchronized (_shortValMarked_mutex) {
+ _shortValMarked = false;
+ }
+ synchronized (_longValMarked_mutex) {
+ _longValMarked = false;
+ }
+ synchronized (_floatValMarked_mutex) {
+ _floatValMarked = false;
+ }
+ synchronized (_doubleValMarked_mutex) {
+ _doubleValMarked = false;
+ }
+ synchronized (_octetSeqVal_mutex) {
+ _octetSeqVal = null;
+ }
+ synchronized (_shortSeqVal_mutex) {
+ _shortSeqVal = null;
+ }
+ synchronized (_longSeqVal_mutex) {
+ _longSeqVal = null;
+ }
+ synchronized (_floatSeqVal_mutex) {
+ _floatSeqVal = null;
+ }
+ synchronized (_doubleSeqVal_mutex) {
+ _doubleSeqVal = null;
+ }
_registered = false;
}
@@ -215,21 +275,31 @@
}
}
+ private final Object _octetValMarked_mutex = new Object();
private boolean _octetValMarked;
private byte _octetVal;
+ private final Object _shortValMarked_mutex = new Object();
private boolean _shortValMarked;
private short _shortVal;
+ private final Object _longValMarked_mutex = new Object();
private boolean _longValMarked;
private int _longVal;
+ private final Object _floatValMarked_mutex = new Object();
private boolean _floatValMarked;
private float _floatVal;
+ private final Object _doubleValMarked_mutex = new Object();
private boolean _doubleValMarked;
private double _doubleVal;
+ private final Object _octetSeqVal_mutex = new Object();
private byte[] _octetSeqVal;
+ private final Object _shortSeqVal_mutex = new Object();
private short[] _shortSeqVal;
+ private final Object _longSeqVal_mutex = new Object();
private int[] _longSeqVal;
+ private final Object _floatSeqVal_mutex = new Object();
private float[] _floatSeqVal;
+ private final Object _doubleSeqVal_mutex = new Object();
private double[] _doubleSeqVal;
private boolean _registered;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -70,6 +70,10 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
CorbaConsumer<DataFlowComponent> conin =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
@@ -80,6 +84,10 @@
PortServiceListHolder pout = new PortServiceListHolder();
pout.value = new PortService[0];
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleIn0 component
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
@@ -102,6 +110,10 @@
eclisti.value = coninRef.get_owned_contexts();
eclisti.value[0].activate_component(coninRef);
+ if(conout == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleOut0 component
try {
conout.setObject(naming.resolve("ConsoleOut0.rtc"));
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConsoleInImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -146,7 +146,10 @@
System.out.println("Please input number: ");
BufferedReader buff = new BufferedReader(new InputStreamReader( System.in ));
try {
- m_out_val.data = Integer.parseInt(buff.readLine());
+ String str = buff.readLine();
+ if(str != null){
+ m_out_val.data = Integer.parseInt(str);
+ }
} catch (NumberFormatException e) {
System.out.println("Input number Error!");
// e.printStackTrace();
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -17,7 +17,7 @@
import jp.go.aist.rtm.RTC.util.ORBUtil;
import jp.go.aist.rtm.RTC.util.StringUtil;
import jp.go.aist.rtm.RTC.util.Properties;
-import jp.go.aist.rtm.RTC.util.RTShellUtil;
+import jp.go.aist.rtm.RTC.util.CORBA_RTCUtil;
import org.omg.CORBA.ORB;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
@@ -57,6 +57,7 @@
if(out_impl==null)
{
System.out.println("ConsoleOut is null.");
+ return;
}
//
Properties prop_in = new Properties(ConsoleIn.component_conf);
@@ -65,6 +66,7 @@
if(in_impl==null)
{
System.out.println("ConsoleIn is null.");
+ return;
}
//
Properties prop_out_seq = new Properties(MyServiceConsumer.component_conf);
@@ -75,6 +77,7 @@
if(out_seq_impl==null)
{
System.out.println("MyServiceConsumer is null.");
+ return;
}
//
//
@@ -115,6 +118,14 @@
CorbaConsumer<DataFlowComponent> conout =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
// find ConsoleOut0 component
+ if(conout == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
try {
conout.setObject(naming.resolve(".host_cxt/ConsoleOut0.rtc"));
} catch (NotFound e) {
@@ -137,7 +148,11 @@
// get_actual_ec
//
System.out.println( "-get_actual_ec");
- ExecutionContext ec = RTShellUtil.get_actual_ec(conoutRef,0);
+ ExecutionContext ec = CORBA_RTCUtil.get_actual_ec(conoutRef,0);
+ if(ec == null) {
+ System.out.println("ec is null.");
+ return;
+ }
assert ec.equals(eclisto.value[0]);
if(ec.equals(eclisto.value[0])) {
System.out.println( "OK");
@@ -146,7 +161,11 @@
System.out.println( "NG");
}
- ec = RTShellUtil.get_actual_ec(conoutRef,1);
+ ec = CORBA_RTCUtil.get_actual_ec(conoutRef,1);
+ if(ec == null) {
+ System.out.println("ec is null.");
+ return;
+ }
assert ec.equals(eclisto.value[1]);
if(ec.equals(eclisto.value[1])) {
System.out.println( "OK");
@@ -154,7 +173,7 @@
else{
System.out.println( "NG");
}
- ec = RTShellUtil.get_actual_ec(conoutRef,2);
+ ec = CORBA_RTCUtil.get_actual_ec(conoutRef,2);
assert ec == null;
if(ec==null) {
System.out.println( "OK");
@@ -167,7 +186,7 @@
// get_ec_id
//
System.out.println( "-get_ec_id");
- int id = RTShellUtil.get_ec_id(conoutRef, eclisto.value[0]);
+ int id = CORBA_RTCUtil.get_ec_id(conoutRef, eclisto.value[0]);
System.out.println( "id : " + id );
assert id == 0;
if(id == 0){
@@ -176,7 +195,7 @@
else{
System.out.println( "NG");
}
- id = RTShellUtil.get_ec_id(conoutRef, eclisto.value[1]);
+ id = CORBA_RTCUtil.get_ec_id(conoutRef, eclisto.value[1]);
System.out.println( "id : " + id );
assert id == 1;
if(id == 1){
@@ -185,7 +204,7 @@
else{
System.out.println( "NG");
}
- id = RTShellUtil.get_ec_id(conoutRef, null);
+ id = CORBA_RTCUtil.get_ec_id(conoutRef, null);
System.out.println( "id : " + id );
assert id == -1;
if(id == -1){
@@ -194,7 +213,7 @@
else{
System.out.println( "NG");
}
- id = RTShellUtil.get_ec_id(null, eclisto.value[1]);
+ id = CORBA_RTCUtil.get_ec_id(null, eclisto.value[1]);
System.out.println( "id : " + id );
assert id == -1;
if(id == -1){
@@ -203,7 +222,7 @@
else{
System.out.println( "NG");
}
- id = RTShellUtil.get_ec_id(conoutRef, eclistseq.value[0]);
+ id = CORBA_RTCUtil.get_ec_id(conoutRef, eclistseq.value[0]);
System.out.println( "id : " + id );
assert id == -1;
if(id == -1){
@@ -217,7 +236,7 @@
//
{
System.out.println( "-activate/deactivate");
- ReturnCode_t ret = RTShellUtil.activate(null, 0);
+ ReturnCode_t ret = CORBA_RTCUtil.activate(null, 0);
assert ret == ReturnCode_t.BAD_PARAMETER;
if(ret == ReturnCode_t.BAD_PARAMETER){
System.out.println( "OK");
@@ -225,7 +244,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.activate(conoutRef, 3);
+ ret = CORBA_RTCUtil.activate(conoutRef, 3);
assert ret == ReturnCode_t.BAD_PARAMETER;
if(ret == ReturnCode_t.BAD_PARAMETER){
System.out.println( "OK");
@@ -233,7 +252,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.deactivate(null, 0);
+ ret = CORBA_RTCUtil.deactivate(null, 0);
assert ret == ReturnCode_t.BAD_PARAMETER;
if(ret == ReturnCode_t.BAD_PARAMETER){
System.out.println( "OK");
@@ -241,7 +260,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.deactivate(conoutRef, 3);
+ ret = CORBA_RTCUtil.deactivate(conoutRef, 3);
assert ret == ReturnCode_t.BAD_PARAMETER;
if(ret == ReturnCode_t.BAD_PARAMETER){
System.out.println( "OK");
@@ -249,7 +268,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.activate(conoutRef, 0);
+ ret = CORBA_RTCUtil.activate(conoutRef, 0);
assert ret == ReturnCode_t.RTC_OK;
if(ret == ReturnCode_t.RTC_OK){
System.out.println( "OK");
@@ -257,7 +276,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.deactivate(conoutRef, 0);
+ ret = CORBA_RTCUtil.deactivate(conoutRef, 0);
assert ret == ReturnCode_t.RTC_OK;
if(ret == ReturnCode_t.RTC_OK){
System.out.println( "OK");
@@ -266,7 +285,7 @@
System.out.println( "NG");
}
/*
- ret = RTShellUtil.activate(conoutRef, 1);
+ ret = CORBA_RTCUtil.activate(conoutRef, 1);
assert ret == ReturnCode_t.RTC_OK;
if(ret == ReturnCode_t.RTC_OK){
System.out.println( "OK");
@@ -274,7 +293,7 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.deactivate(conoutRef, 1);
+ ret = CORBA_RTCUtil.deactivate(conoutRef, 1);
assert ret == ReturnCode_t.RTC_OK;
if(ret == ReturnCode_t.RTC_OK){
System.out.println( "OK");
@@ -302,7 +321,7 @@
}
- LifeCycleState ret = RTShellUtil.get_state(conoutRef, 0);
+ LifeCycleState ret = CORBA_RTCUtil.get_state(conoutRef, 0);
String str_ret = getStateString(ret);
System.out.println(str_ret);
assert str_ret.equals("INACTIVE_STATE");
@@ -313,13 +332,13 @@
System.out.println( "NG");
}
//
- RTShellUtil.activate(conoutRef, 0);
+ CORBA_RTCUtil.activate(conoutRef, 0);
try{
Thread.sleep(500);
}
catch(InterruptedException e){
}
- ret = RTShellUtil.get_state(conoutRef, 0);
+ ret = CORBA_RTCUtil.get_state(conoutRef, 0);
str_ret = getStateString(ret);
System.out.println(str_ret);
assert str_ret.equals("ACTIVE_STATE");
@@ -330,13 +349,13 @@
System.out.println( "NG");
}
//
- RTShellUtil.deactivate(conoutRef, 0);
+ CORBA_RTCUtil.deactivate(conoutRef, 0);
try{
Thread.sleep(500);
}
catch(InterruptedException e){
}
- ret = RTShellUtil.get_state(conoutRef, 0);
+ ret = CORBA_RTCUtil.get_state(conoutRef, 0);
str_ret = getStateString(ret);
assert str_ret.equals("INACTIVE_STATE");
if(str_ret.equals("INACTIVE_STATE")){
@@ -347,7 +366,7 @@
}
System.out.println(str_ret);
//
- ret = RTShellUtil.get_state(null, 0);
+ ret = CORBA_RTCUtil.get_state(null, 0);
str_ret = getStateString(ret);
assert str_ret.equals("ERROR_STATE");
if(str_ret.equals("ERROR_STATE")){
@@ -358,7 +377,7 @@
}
System.out.println(str_ret);
//
- ret = RTShellUtil.get_state(conoutRef, 3);
+ ret = CORBA_RTCUtil.get_state(conoutRef, 3);
str_ret = getStateString(ret);
assert str_ret.equals("ERROR_STATE");
if(str_ret.equals("ERROR_STATE")){
@@ -375,7 +394,7 @@
//
{
System.out.println( "-is_in_active");
- if(!RTShellUtil.is_in_active(conoutRef, 0)){
+ if(!CORBA_RTCUtil.is_in_active(conoutRef, 0)){
System.out.println( "OK");
}
else{
@@ -382,13 +401,13 @@
System.out.println( "NG");
}
//
- RTShellUtil.activate(conoutRef, 0);
+ CORBA_RTCUtil.activate(conoutRef, 0);
try{
Thread.sleep(500);
}
catch(InterruptedException e){
}
- if(RTShellUtil.is_in_active(conoutRef, 0)){
+ if(CORBA_RTCUtil.is_in_active(conoutRef, 0)){
System.out.println( "OK");
}
else{
@@ -395,13 +414,13 @@
System.out.println( "NG");
}
//
- RTShellUtil.deactivate(conoutRef, 0);
+ CORBA_RTCUtil.deactivate(conoutRef, 0);
try{
Thread.sleep(500);
}
catch(InterruptedException e){
}
- if(!RTShellUtil.is_in_active(conoutRef, 0)){
+ if(!CORBA_RTCUtil.is_in_active(conoutRef, 0)){
System.out.println( "OK");
}
else{
@@ -408,13 +427,13 @@
System.out.println( "NG");
}
//
- if(!RTShellUtil.is_in_active(null, 0)){
+ if(!CORBA_RTCUtil.is_in_active(null, 0)){
System.out.println( "OK");
}
else{
System.out.println( "NG");
}
- if(!RTShellUtil.is_in_active(conoutRef, 3)){
+ if(!CORBA_RTCUtil.is_in_active(conoutRef, 3)){
System.out.println( "OK");
}
else{
@@ -428,7 +447,7 @@
{
System.out.println( "-get_default_rate/set_default_rate");
- double ret = RTShellUtil.get_default_rate(conoutRef);
+ double ret = CORBA_RTCUtil.get_default_rate(conoutRef);
if(ret == 1000.0){
System.out.println( "OK");
}
@@ -435,8 +454,8 @@
else{
System.out.println( "NG");
}
- RTShellUtil.set_default_rate(conoutRef, 500.0);
- ret = RTShellUtil.get_default_rate(conoutRef);
+ CORBA_RTCUtil.set_default_rate(conoutRef, 500.0);
+ ret = CORBA_RTCUtil.get_default_rate(conoutRef);
if(ret == 500.0){
System.out.println( "OK");
}
@@ -443,8 +462,8 @@
else{
System.out.println( "NG");
}
- ret = RTShellUtil.get_default_rate(null);
- ReturnCode_t code = RTShellUtil.set_default_rate(null, 500.0);
+ ret = CORBA_RTCUtil.get_default_rate(null);
+ ReturnCode_t code = CORBA_RTCUtil.set_default_rate(null, 500.0);
if(code == ReturnCode_t.BAD_PARAMETER){
System.out.println( "OK");
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -10,7 +10,7 @@
import jp.go.aist.rtm.RTC.port.CorbaConsumer;
import jp.go.aist.rtm.RTC.util.Properties;
-import jp.go.aist.rtm.RTC.util.RTShellUtil;
+import jp.go.aist.rtm.RTC.util.CORBA_RTCUtil;
import jp.go.aist.rtm.RTC.util.ORBUtil;
import RTC.RTObject;
@@ -30,6 +30,10 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
//
//
@@ -37,6 +41,11 @@
CorbaConsumer<DataFlowComponent> conin =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
+
// find ConsoleIn0 component
try {
System.out.println( "args[0]:"+args[0] );
@@ -52,7 +61,7 @@
RTObject coninRef = conin._ptr();
Properties coninProp = new Properties();
- coninProp = RTShellUtil.get_component_profile(coninRef);
+ coninProp = CORBA_RTCUtil.get_component_profile(coninRef);
String str = new String();
str = coninProp._dump(str,coninProp,0);
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -10,7 +10,7 @@
import jp.go.aist.rtm.RTC.port.CorbaConsumer;
import jp.go.aist.rtm.RTC.util.Properties;
-import jp.go.aist.rtm.RTC.util.RTShellUtil;
+import jp.go.aist.rtm.RTC.util.CORBA_RTCUtil;
import jp.go.aist.rtm.RTC.util.ORBUtil;
import RTC.RTObject;
@@ -30,6 +30,10 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
//
//
@@ -39,7 +43,7 @@
{
RTObject coninRef = conin._ptr();
- if( RTShellUtil.is_alive_in_default_ec(coninRef)) {
+ if( CORBA_RTCUtil.is_alive_in_default_ec(coninRef)) {
System.out.println( "EC of " +args[0] + " exists." );
}
else {
@@ -46,6 +50,10 @@
System.out.println( "EC of " +args[0] + " doesn't exist." );
}
}
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find component
try {
conin.setObject(naming.resolve(args[0]));
@@ -58,7 +66,7 @@
}
RTObject coninRef = conin._ptr();
- if( RTShellUtil.is_alive_in_default_ec(coninRef)) {
+ if( CORBA_RTCUtil.is_alive_in_default_ec(coninRef)) {
System.out.println( "EC of " +args[0] + " exist." );
}
else {
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -10,7 +10,7 @@
import jp.go.aist.rtm.RTC.port.CorbaConsumer;
import jp.go.aist.rtm.RTC.util.Properties;
-import jp.go.aist.rtm.RTC.util.RTShellUtil;
+import jp.go.aist.rtm.RTC.util.CORBA_RTCUtil;
import jp.go.aist.rtm.RTC.util.ORBUtil;
import RTC.RTObject;
@@ -30,6 +30,10 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
//
//
@@ -39,7 +43,7 @@
{
RTObject coninRef = conin._ptr();
- if( RTShellUtil.is_existing(coninRef)) {
+ if( CORBA_RTCUtil.is_existing(coninRef)) {
System.out.println( args[0] + " exists." );
}
else {
@@ -46,6 +50,9 @@
System.out.println( args[0] + " doesn't exist." );
}
}
+ if(conin == null){
+ return;
+ }
// find component
try {
conin.setObject(naming.resolve(args[0]));
@@ -58,7 +65,7 @@
}
RTObject coninRef = conin._ptr();
- if( RTShellUtil.is_existing(coninRef)) {
+ if( CORBA_RTCUtil.is_existing(coninRef)) {
System.out.println( args[0] + " exist." );
}
else {
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -90,6 +90,10 @@
} catch (IOException e) {
e.printStackTrace();
}
+
+ if(args == null){
+ return super.onExecute(ec_id);
+ }
pos = args.indexOf(" ");
if( pos>0 ) {
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -166,10 +166,18 @@
} catch (Exception e) {
e.printStackTrace();
}
+ if( naming == null ){
+ System.out.println("CorbaNaming is null.");
+ return;
+ }
CorbaConsumer<DataFlowComponent> conin =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
} catch (NotFound e) {
@@ -185,6 +193,10 @@
CorbaConsumer<DataFlowComponent> conout =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conout == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
try {
conout.setObject(naming.resolve("ConsoleOut0.rtc"));
} catch (NotFound e) {
@@ -199,11 +211,16 @@
PortService port1_var =
CORBA_RTCUtil.get_port_by_name(conout._ptr(), "ConsoleOut0.topic_in");
- if(CORBA_RTCUtil.already_connected(port0_var, port1_var)){
- System.out.println( "OK");
+ if((port0_var != null) && (port1_var != null)){
+ if(CORBA_RTCUtil.already_connected(port0_var, port1_var)){
+ System.out.println( "OK");
+ }
+ else{
+ System.out.println( "Fail");
+ }
}
else{
- System.out.println( "Fail");
+ System.out.println( "Fail");
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConsoleInImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConsoleInImpl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConsoleInImpl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -158,7 +158,10 @@
System.out.println("Please input number: ");
BufferedReader buff = new BufferedReader(new InputStreamReader( System.in ));
try {
- m_out_val.data = Integer.parseInt(buff.readLine());
+ String str = buff.readLine();
+ if(str != null){
+ m_out_val.data = Integer.parseInt(str);
+ }
} catch (NumberFormatException e) {
System.out.println("Input number Error!");
// e.printStackTrace();
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ConfigAdmin.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ConfigAdmin.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ConfigAdmin.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -692,7 +692,7 @@
*/
public final Properties getConfigurationSet(final String config_id) {
Properties p = new Properties(m_configsets.getNode(config_id));
- if( p == null ) return m_emptyconf;
+ //if( p == null ) return m_emptyconf;
return p;
}
@@ -755,7 +755,6 @@
Properties prop = m_configsets.getNode(m_activeId);
if( prop == null ) return m_emptyconf;
Properties p = new Properties(prop);
- if( p == null ) return m_emptyconf;
return p;
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -1556,19 +1556,16 @@
}
// no more binding -> do-while loop will be finished
- if( bi==null ) cont = false;
- else {
- if( bi.value!=null ) {
- if( bi.value.next_n(m_blLength, bl) == false )
- return;
- } else {
+ if( bi.value!=null ) {
+ if( bi.value.next_n(m_blLength, bl) == false )
return;
- }
- }
+ } else {
+ return;
+ }
}
- if( bi!=null ) bi.value.destroy();
- return;
+ bi.value.destroy();
+ return;
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -261,9 +261,12 @@
* {@.en Existence of the only instance reference of the manager}
*/
public static boolean isActive() {
- if(manager==null)
- return false;
- return true;
+ synchronized (manager_mutex) {
+ if(manager==null) {
+ return false;
+ }
+ return true;
+ }
}
/**
@@ -506,7 +509,6 @@
prop.getProperty("rendezvous_point")=="" )
){
-
continue;
}
PortService[] nsports;
@@ -1616,9 +1618,6 @@
try {
ECFactoryBase factory = new ECFactoryJava(name);
- if( factory == null ) {
- return false;
- }
if( !m_ecfactory.registerObject(factory, new ECFactoryPredicate(factory))) {
factory = null;
return false;
@@ -3295,23 +3294,25 @@
try{
java.util.Enumeration<java.net.NetworkInterface> nic
= java.net.NetworkInterface.getNetworkInterfaces();
- endpoints = new String();
- while(nic.hasMoreElements()) {
- java.net.NetworkInterface netIf = nic.nextElement();
- java.util.Enumeration<java.net.InetAddress> enumAddress
- = netIf.getInetAddresses();
- while(enumAddress.hasMoreElements()){
- java.net.InetAddress inetAdd
- = enumAddress.nextElement();
- String hostString = inetAdd.getHostAddress();
- if(isIpAddressFormat(hostString)){
- if(endpoints.length()!=0){
- endpoints
- = endpoints + "," + hostString + ":";
+ if(nic != null) {
+ endpoints = new String();
+ while(nic.hasMoreElements()) {
+ java.net.NetworkInterface netIf = nic.nextElement();
+ java.util.Enumeration<java.net.InetAddress> enumAddress
+ = netIf.getInetAddresses();
+ while(enumAddress.hasMoreElements()){
+ java.net.InetAddress inetAdd
+ = enumAddress.nextElement();
+ String hostString = inetAdd.getHostAddress();
+ if(isIpAddressFormat(hostString)){
+ if(endpoints.length()!=0){
+ endpoints
+ = endpoints + "," + hostString + ":";
+ }
+ else{
+ endpoints = hostString + ":";
+ }
}
- else{
- endpoints = hostString + ":";
- }
}
}
}
@@ -3638,7 +3639,7 @@
Properties temp = m_config.getNode(category + "." + inst_name);
Vector<String> keys = temp.propertyNames();
int length = keys.size();
- if (!( length == 1 && keys.get(length-1).equals("config_file"))) {
+ if (!( length == 1 && keys.lastElement().equals("config_file"))) {
name_prop.merge(m_config.getNode(category + "." + inst_name));
rtcout.println(Logbuf.INFO,
"Component type conf exists in rtc.conf. Merged.");
@@ -3687,7 +3688,7 @@
Properties temp = m_config.getNode(category + "." + type_name);
Vector<String> keys = temp.propertyNames();
int length = keys.size();
- if (!(length == 1 && keys.get(length-1).equals("config_file"))) {
+ if (!(length == 1 && keys.lastElement().equals("config_file"))) {
type_prop.merge(m_config.getNode(category + "." + type_name));
rtcout.println(Logbuf.INFO,
"Component type conf exists in rtc.conf. Merged.");
@@ -4050,7 +4051,7 @@
str.append(properties.getProperty("category"));
}
else if (c == 'h') {
- str.append(m_config.getProperty("manager.os.hostname"));
+ str.append(m_config.getProperty("os.hostname"));
}
else if (c == 'M') {
str.append(m_config.getProperty("manager.name"));
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -18,6 +18,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.HelpFormatter;
/**
* {@.ja Managerのコンフィグレーションを表現するクラスです。}
@@ -243,6 +244,8 @@
commandLine = parser.parse(options, args);
} catch (ParseException e) {
+ HelpFormatter help = new HelpFormatter();
+ help.printHelp("UpdateKeyword", options, true);
throw new IllegalArgumentException("Could not parse arguments.");
}
@@ -261,7 +264,11 @@
m_argprop.setProperty("manager.corba_servant","NO");;
}
if (commandLine.hasOption("f")) {
- this.m_configFile = commandLine.getOptionValue("f").trim();
+ //this.m_configFile = commandLine.getOptionValue("f").trim();
+ String str = commandLine.getOptionValue("f");
+ if(str != null){
+ this.m_configFile = str.trim();
+ }
}
if (commandLine.hasOption("l")) {
// do nothing
@@ -278,17 +285,21 @@
*/
if (commandLine.hasOption("p")) {
// ORB's port number
- String str = commandLine.getOptionValue("p").trim();
- int portnum;
- try {
- portnum = Integer.parseInt(str);
- String arg = ":";
- arg += str;
- m_argprop.setProperty("corba.endpoints", arg);
+ //String str = commandLine.getOptionValue("p").trim();
+ String str = commandLine.getOptionValue("p");
+ if(str != null){
+ str = str.trim();
+ int portnum;
+ try {
+ portnum = Integer.parseInt(str);
+ String arg = ":";
+ arg += str;
+ m_argprop.setProperty("corba.endpoints", arg);
+ }
+ catch(Exception ex){
+ //do nothing
+ }
}
- catch(Exception ex){
- //do nothing
- }
}
if (commandLine.hasOption("d")) {
m_isMaster = true;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -612,6 +612,9 @@
}
java.io.File dir = new java.io.File(loadpath);
String[] flist = dir.list(new FileFilter());
+ if(flist == null) {
+ continue;
+ }
for (int ic=0; ic < flist.length; ++ic) {
dlls.add(loadpath+separator+flist[ic]);
}
@@ -644,6 +647,9 @@
}
}
try {
+ if(target == null){
+ continue;
+ }
Field field = target.getField("component_conf");
String[] data = (String[])field.get(null);
java.util.ArrayList al
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingManager.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -396,7 +396,9 @@
* {@.en List of NameService}
*/
public Vector<NamingService> getNameServices() {
- return m_names;
+ synchronized (m_names) {
+ return m_names;
+ }
}
/**
*
@@ -460,7 +462,6 @@
NamingOnCorba nameb
= new NamingOnCorba(m_manager.getORB(), name_server);
NamingBase name = nameb;
- if( name == null ) return null;
rtcout.println(Logbuf.INFO,
"NameServer connection succeeded: "
+ method + "/" + name_server);
@@ -474,9 +475,6 @@
}
else if( m.endsWith("manager")) {
NamingBase name = new NamingOnManager(m_manager.getORB(),m_manager);
- if( name == null ) {
- return null;
- }
return name;
}
return null;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -3041,6 +3041,7 @@
}
return ret;
}
+ /*
public final Vector<InPortBase> getInPorts() {
return m_inports;
}
@@ -3047,7 +3048,7 @@
public final Vector<OutPortBase> getOutPorts() {
return m_outports;
}
-
+ */
/**
* {@.ja [local interface] DataInPort を登録します。}
* {@.en [local interface] Register DataInPort.}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -951,7 +951,9 @@
rtcout.println(Logbuf.TRACE, "Configuration_impl.getDeviceProfile()");
- return m_deviceProfile;
+ synchronized(m_device_profile_lock){
+ return m_deviceProfile;
+ }
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/StateMachine.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -408,9 +408,11 @@
* {@.en Initial state}
*/
public void setStartState(StateHolder states) {
- m_states.curr = (STATE)(states.curr);
- m_states.prev = (STATE)states.prev;
- m_states.next = (STATE)states.next;
+ synchronized (m_states) {
+ m_states.curr = (STATE)(states.curr);
+ m_states.prev = (STATE)states.prev;
+ m_states.next = (STATE)states.next;
+ }
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/buffer/RingBuffer.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/buffer/RingBuffer.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/buffer/RingBuffer.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -109,8 +109,10 @@
*
*/
public ReturnCode length(int n) {
- m_buffer.setSize(n);
- m_length = n;
+ synchronized (m_posmutex) {
+ m_buffer.setSize(n);
+ m_length = n;
+ }
this.reset();
return ReturnCode.BUFFER_OK; //BUFFER_OK;
}
@@ -415,8 +417,10 @@
local_nsec = (int)(m_rtimeout.usec() % 1000)*1000;
}
if (readback && !timedread) { // "readback" mode
- if (!(m_wcount > 0)) {
- return ReturnCode.BUFFER_EMPTY;
+ synchronized (m_posmutex) {
+ if (!(m_wcount > 0)) {
+ return ReturnCode.BUFFER_EMPTY;
+ }
}
advanceRptr(-1);
}
@@ -966,7 +970,9 @@
try {
double tm = Double.parseDouble(prop.getProperty("write.timeout"));
if (!(tm < 0)) {
- m_wtimeout.convert(tm);
+ synchronized (m_full.mutex) {
+ m_wtimeout.convert(tm);
+ }
}
}
catch(NumberFormatException e){
@@ -996,7 +1002,9 @@
try {
double tm = Double.parseDouble(prop.getProperty("read.timeout"));
if (!(tm < 0)) {
- m_rtimeout.convert(tm);
+ synchronized (m_empty.mutex) {
+ m_rtimeout.convert(tm);
+ }
}
}
catch(NumberFormatException e){
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -221,7 +221,12 @@
}
}
public final String getKindString() {
- return getKindString(m_profile.kind);
+ //return getKindString(m_profile.kind);
+ String str = new String();
+ synchronized (m_profile){
+ str = getKindString(m_profile.kind);
+ }
+ return str;
}
/**
@@ -432,10 +437,12 @@
*
*/
public final RTObject[] getComponentList() {
- rtcout.println(Logbuf.TRACE,"getComponentList("
+ synchronized (m_profile){
+ rtcout.println(Logbuf.TRACE,"getComponentList("
+ m_profile.participants.length
+")");
- return m_profile.participants;
+ return m_profile.participants;
+ }
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -77,7 +77,9 @@
*/
public boolean isRunning() {
rtcout.println(Logbuf.TRACE, "isRunning()");
- return m_running;
+ synchronized (m_mutex){
+ return m_running;
+ }
}
/**
@@ -637,10 +639,10 @@
RTObjectStateMachine rtobj = m_removedComps.get(ic);
LightweightRTObject lwrtobj = rtobj.getRTObject();
lwrtobj.detach_context(rtobj.getExecutionContextHandle());
- Iterator it = m_comps.iterator();
+ Iterator<RTObjectStateMachine> it = m_comps.iterator();
while (it.hasNext()) {
if(rtobj == (RTObjectStateMachine)it.next()){
- m_comps.remove(it);
+ it.remove();
}
}
rtobj = null;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/OpenHRPExecutionContext.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -30,11 +30,11 @@
* <p> tick </p>
*/
public void tick() throws SystemException {
- if(m_workerthread.isRunning())
- {
- return ;
- }
synchronized (m_tickmutex) {
+ if(m_workerthread.isRunning())
+ {
+ return ;
+ }
m_workerthread.invokeWorkerPostDo();
TimeValue t0 = new TimeValue();
t0.convert(System.nanoTime()/1000);
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicECOrganization.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicECOrganization.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicECOrganization.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -446,7 +446,7 @@
for(int i=0; i < orglist.length; ++i) {
SDO[] sdos = orglist[i].get_members();
for (int j=0; j < sdos.length; ++j) {
- DataFlowComponentHolder dfc = null;
+ DataFlowComponentHolder dfc = new DataFlowComponentHolder();
if (!sdoToDFC(sdos[j], dfc)) {
continue;
}
@@ -485,7 +485,7 @@
for (int i=0; i < orglist.length; ++i) {
SDO[] sdos = orglist[i].get_members();
for (int j=0; j < sdos.length; ++j) {
- DataFlowComponentHolder dfc = null;
+ DataFlowComponentHolder dfc = new DataFlowComponentHolder();
if (!sdoToDFC(sdos[j], dfc)) {
continue;
}
@@ -598,10 +598,9 @@
String plist
= m_rtobj.getProperties().getProperty("conf.default.exported_ports");
+ plist = plist.replace(" ,",",");
+ plist = plist.replace(", ",",");
m_expPorts = StringUtil.split(plist, ",");
- for (int i=0; i<m_expPorts.size(); ++i) {
- m_expPorts.set(i,m_expPorts.get(i).trim());
- }
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -492,8 +492,10 @@
public boolean isEmpty() {
rtcout.println(Logbuf.TRACE, "isEmpty()");
- if (m_directNewData == true) {
- return false;
+ synchronized (m_directNewDataMutex){
+ if (m_directNewData == true) {
+ return false;
+ }
}
int r = 0;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortBase.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -688,13 +688,21 @@
}
*/
}
- int index = NVUtil.find_index(holder, "dataport.serializer.cdr.endian");
- holder.value[index].value.insert_string(endian_type);
+ int index =
+ NVUtil.find_index(holder, "dataport.serializer.cdr.endian");
+ if(index<0) {
+ CORBA_SeqUtil.push_back(holder,
+ NVUtil.newNVString("dataport.serializer.cdr.endian",
+ endian_type));
+ }
+ else{
+ holder.value[index].value.insert_string(endian_type);
+ }
cprof.value.properties = holder.value;
- }
- catch(Exception e){
+ }
+ catch(Exception e){
;
- }
+ }
/*
* Because properties of ConnectorProfileHolder was merged,
* the accesses such as prop["dataflow_type"] and
@@ -1420,36 +1428,31 @@
CORBA_SeqUtil.refToVstring(cprof.value.ports),
prop);
InPortConnector connector = null;
- synchronized (m_connectors){
- try {
- if (m_singlebuffer) {
- connector = new InPortPushConnector(profile, provider,
- m_listeners,m_thebuffer);
- }
- else {
- BufferBase<OutputStream> buffer = null;
- connector = new InPortPushConnector(profile, provider,
- m_listeners,buffer);
- }
-
- if (connector == null) {
- rtcout.println(Logbuf.ERROR,
- "old compiler? new returned 0;");
- return null;
- }
- rtcout.println(Logbuf.TRACE, "InPortPushConnector created");
-
+ try {
+ if (m_singlebuffer) {
+ connector = new InPortPushConnector(profile, provider,
+ m_listeners,m_thebuffer);
+ }
+ else {
+ BufferBase<OutputStream> buffer = null;
+ connector = new InPortPushConnector(profile, provider,
+ m_listeners,buffer);
+ }
+
+ rtcout.println(Logbuf.TRACE, "InPortPushConnector created");
+
+ synchronized (m_connectors){
m_connectors.add(connector);
rtcout.println(Logbuf.PARANOID,
- "connector push backed: "+m_connectors.size());
- return connector;
+ "connector push backed: "+m_connectors.size());
}
- catch (Exception e) {
- rtcout.println(Logbuf.ERROR,
- "InPortPushConnector creation failed");
- return null;
- }
+ return connector;
}
+ catch (Exception e) {
+ rtcout.println(Logbuf.ERROR,
+ "InPortPushConnector creation failed");
+ return null;
+ }
}
/**
* {@.ja InPortPullConnector の生成}
@@ -1485,11 +1488,6 @@
buffer);
}
- if (connector == null) {
- rtcout.println(Logbuf.ERROR,
- "old compiler? new returned 0;");
- return null;
- }
rtcout.println(Logbuf.TRACE, "InPortPullConnector created");
String type = prop.getProperty("interface_type").trim();
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortSHMConsumer.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortSHMConsumer.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPortSHMConsumer.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -522,7 +522,9 @@
* {@.en OutPortConnector}
*/
public void setConnector(OutPortConnector connector) {
- m_connector = connector;
+ synchronized(m_mutex) {
+ m_connector = connector;
+ }
}
private Logbuf rtcout;
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -399,49 +399,53 @@
Vector<String> disconnect_ids = new Vector<String>();
synchronized (m_connectorsMutex){
- // check number of connectors
- int conn_size = m_connectors.size();
- if (!(conn_size > 0)) {
- return false;
- }
+ synchronized (m_connectors){
+ // check number of connectors
+ int conn_size = m_connectors.size();
+ if (!(conn_size > 0)) {
+ return false;
+ }
- // set timestamp
-// set_timestamp(value);
+ // set timestamp
+// set_timestamp(value);
- m_status.setSize(conn_size);
+ m_status.setSize(conn_size);
- for (int i=0, len=conn_size; i < len; ++i) {
- ReturnCode ret;
- // data -> (conversion) -> CDR stream
- if (m_OnWriteConvert != null) {
- rtcout.println(Logbuf.DEBUG,
+ for (int i=0, len=conn_size; i < len; ++i) {
+ ReturnCode ret;
+ // data -> (conversion) -> CDR stream
+ if (m_OnWriteConvert != null) {
+ rtcout.println(Logbuf.DEBUG,
"m_connectors.OnWriteConvert called");
- ret = m_connectors.elementAt(i).write(
+ ret = m_connectors.elementAt(i).write(
m_OnWriteConvert.run(value));
- }
- else{
- rtcout.println(Logbuf.DEBUG,
+ }
+ else{
+ rtcout.println(Logbuf.DEBUG,
"m_connectors.write called");
- ret = m_connectors.elementAt(i).write(value);
- }
+ ret = m_connectors.elementAt(i).write(value);
+ }
- m_status.add(i, ret);
- if (ret.equals(ReturnCode.PORT_OK)) {
- continue;
- }
+ m_status.add(i, ret);
+ if (ret.equals(ReturnCode.PORT_OK)) {
+ continue;
+ }
- result = false;
- String id = m_connectors.elementAt(i).id();
+ result = false;
+ String id = m_connectors.elementAt(i).id();
- if (ret.equals(ReturnCode.CONNECTION_LOST)) {
- rtcout.println(Logbuf.TRACE, "connection_lost id: "+id);
- if(m_onConnectionLost != null) {
- RTC.ConnectorProfile prof = findConnProfile(id);
- RTC.ConnectorProfileHolder holder
- = new RTC.ConnectorProfileHolder(prof);
- m_onConnectionLost.run(holder);
+ if (ret.equals(ReturnCode.CONNECTION_LOST)) {
+ rtcout.println(Logbuf.TRACE, "connection_lost id: "+id);
+ synchronized (m_onConnectionLost_mutex){
+ if(m_onConnectionLost != null) {
+ RTC.ConnectorProfile prof = findConnProfile(id);
+ RTC.ConnectorProfileHolder holder
+ = new RTC.ConnectorProfileHolder(prof);
+ m_onConnectionLost.run(holder);
+ }
+ }
+ disconnect_ids.add(id);
}
- disconnect_ids.add(id);
}
}
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -180,9 +180,11 @@
*
*/
public final Vector<OutPortConnector> connectors(){
- rtcout.println(Logbuf.TRACE,
+ synchronized (m_connectors){
+ rtcout.println(Logbuf.TRACE,
"connectors(): size = "+m_connectors.size());
- return m_connectors;
+ return m_connectors;
+ }
}
/**
* {@.ja ConnectorProfile を取得}
@@ -199,11 +201,11 @@
*
*/
public Vector<ConnectorBase.ConnectorInfo> getConnectorProfiles(){
- rtcout.println(Logbuf.TRACE,
- "getConnectorProfiles(): size = "+m_connectors.size());
Vector<ConnectorBase.ConnectorInfo> profs
= new Vector<ConnectorBase.ConnectorInfo>();
synchronized (m_connectors){
+ rtcout.println(Logbuf.TRACE,
+ "getConnectorProfiles(): size = "+m_connectors.size());
for (int i=0, len=m_connectors.size(); i < len; ++i) {
profs.add(m_connectors.elementAt(i).profile());
}
@@ -573,13 +575,15 @@
"invalid connection_limit value: "+_str );
}
- int value = _type;
+ int value = _type;
- if(value <= m_connectors.size()) {
- return ReturnCode_t.PRECONDITION_NOT_MET;
- }
+ synchronized (m_connectors){
+ if(value <= m_connectors.size()) {
+ return ReturnCode_t.PRECONDITION_NOT_MET;
+ }
+ }
- return super.notify_connect(connector_profile);
+ return super.notify_connect(connector_profile);
}
/**
@@ -688,8 +692,16 @@
}
*/
}
- int index = NVUtil.find_index(holder, "dataport.serializer.cdr.endian");
- holder.value[index].value.insert_string(endian_type);
+ int index =
+ NVUtil.find_index(holder, "dataport.serializer.cdr.endian");
+ if(index<0) {
+ CORBA_SeqUtil.push_back(holder,
+ NVUtil.newNVString("dataport.serializer.cdr.endian",
+ endian_type));
+ }
+ else{
+ holder.value[index].value.insert_string(endian_type);
+ }
cprof.value.properties = holder.value;
}
catch(Exception e){
@@ -1580,11 +1592,6 @@
connector = new OutPortPushConnector(profile, consumer,
m_listeners, buffer);
- if (connector == null) {
- rtcout.println(Logbuf.ERROR,
- "old compiler? new returned 0;");
- return null;
- }
rtcout.println(Logbuf.TRACE, "OutPortPushConnector created");
String type = prop.getProperty("interface_type").trim();
@@ -1635,11 +1642,6 @@
connector = new OutPortPullConnector(profile, provider,
m_listeners, buffer);
- if (connector == null) {
- rtcout.println(Logbuf.ERROR,
- "old compiler? new returned 0;");
- return null;
- }
rtcout.println(Logbuf.TRACE, "OutPortPullConnector create");
m_connectors.add(connector);
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortSHMConsumer.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortSHMConsumer.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortSHMConsumer.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -127,7 +127,9 @@
*/
public void setBuffer(BufferBase<OutputStream> buffer) {
rtcout.println(Logbuf.TRACE, "OutPortSHMConsumer.setBuffer()");
- m_buffer = buffer;
+ synchronized(m_mutex) {
+ m_buffer = buffer;
+ }
}
/**
* {@.ja リスナを設定する。}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -422,7 +422,11 @@
return;
}
- removePort(this.m_portServants.find(new find_port_name(portName)));
+ PortBase port = this.m_portServants.find(new find_port_name(portName));
+ if(port != null){
+ removePort(port);
+ }
+ //removePort(this.m_portServants.find(new find_port_name(portName)));
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -768,8 +768,11 @@
"publishInterfaces() in notify_connect() failed.");
}
onPublishInterfaces(getName(), connector_profile.value, retval[0]);
- if (m_onPublishInterfaces != null) {
- m_onPublishInterfaces.run(connector_profile);
+
+ synchronized (m_onPublishInterfaces_mutex){
+ if (m_onPublishInterfaces != null) {
+ m_onPublishInterfaces.run(connector_profile);
+ }
}
@@ -782,8 +785,10 @@
onConnectNextport(getName(), connector_profile.value, retval[1]);
// subscribe interface from the ConnectorProfile's information
- if (m_onSubscribeInterfaces != null) {
- m_onSubscribeInterfaces.run(connector_profile);
+ synchronized (m_onSubscribeInterfaces_mutex){
+ if (m_onSubscribeInterfaces != null) {
+ m_onSubscribeInterfaces.run(connector_profile);
+ }
}
retval[2] = subscribeInterfaces(connector_profile);
if (! ReturnCode_t.RTC_OK.equals(retval[2])) {
@@ -826,8 +831,10 @@
}
// connection established without errors
- if (m_onConnected != null) {
- m_onConnected.run(connector_profile);
+ synchronized (m_onConnected_mutex){
+ if (m_onConnected != null) {
+ m_onConnected.run(connector_profile);
+ }
}
onConnected(getName(), connector_profile.value, ReturnCode_t.RTC_OK);
return ReturnCode_t.RTC_OK;
@@ -1059,20 +1066,24 @@
onNotifyDisconnect(getName(), prof);
ReturnCode_t retval = disconnectNext(prof);
onDisconnectNextport(getName(), prof, retval);
- if (m_onUnsubscribeInterfaces != null) {
- ConnectorProfileHolder holder
- = new ConnectorProfileHolder(prof);
- m_onUnsubscribeInterfaces.run(holder);
- prof = holder.value;
+ synchronized (m_onUnsubscribeInterfaces_mutex){
+ if (m_onUnsubscribeInterfaces != null) {
+ ConnectorProfileHolder holder
+ = new ConnectorProfileHolder(prof);
+ m_onUnsubscribeInterfaces.run(holder);
+ prof = holder.value;
+ }
}
onUnsubscribeInterfaces(getName(), prof);
unsubscribeInterfaces(prof);
- if (m_onDisconnected != null) {
- ConnectorProfileHolder holder
- = new ConnectorProfileHolder(prof);
- m_onDisconnected.run(holder);
- prof = holder.value;
+ synchronized (m_onDisconnected_mutex){
+ if (m_onDisconnected != null) {
+ ConnectorProfileHolder holder
+ = new ConnectorProfileHolder(prof);
+ m_onDisconnected.run(holder);
+ prof = holder.value;
+ }
}
ConnectorProfileListHolder holder
@@ -1286,7 +1297,9 @@
*
*/
public void setOnPublishInterfaces(ConnectionCallback on_publish) {
- m_onPublishInterfaces = on_publish;
+ synchronized (m_onPublishInterfaces_mutex){
+ m_onPublishInterfaces = on_publish;
+ }
}
/**
@@ -1311,7 +1324,9 @@
*
*/
public void setOnSubscribeInterfaces(ConnectionCallback on_subscribe) {
- m_onSubscribeInterfaces = on_subscribe;
+ synchronized (m_onSubscribeInterfaces_mutex){
+ m_onSubscribeInterfaces = on_subscribe;
+ }
}
/**
@@ -1339,7 +1354,9 @@
*
*/
public void setOnConnected(ConnectionCallback on_connected) {
- m_onConnected = on_connected;
+ synchronized (m_onConnected_mutex){
+ m_onConnected = on_connected;
+ }
}
/**
@@ -1365,7 +1382,9 @@
*
*/
public void setOnUnsubscribeInterfaces(ConnectionCallback on_unsubscribe) {
- m_onUnsubscribeInterfaces = on_unsubscribe;
+ synchronized (m_onUnsubscribeInterfaces_mutex){
+ m_onUnsubscribeInterfaces = on_unsubscribe;
+ }
}
/**
@@ -1390,11 +1409,15 @@
*
*/
public void setOnDisconnected(ConnectionCallback on_disconnected){
- m_onDisconnected = on_disconnected;
+ synchronized (m_onDisconnected_mutex){
+ m_onDisconnected = on_disconnected;
+ }
}
public void setOnConnectionLost(ConnectionCallback on_connection_lost) {
- m_onConnectionLost = on_connection_lost;
+ synchronized (m_onConnectionLost_mutex){
+ m_onConnectionLost = on_connection_lost;
+ }
}
/**
@@ -2214,11 +2237,22 @@
/**
* <p>Callback functor objects</p>
*/
+ private final Object m_onPublishInterfaces_mutex = new Object();
protected ConnectionCallback m_onPublishInterfaces;
+
+ private final Object m_onSubscribeInterfaces_mutex = new Object();
protected ConnectionCallback m_onSubscribeInterfaces;
+
+ private final Object m_onConnected_mutex = new Object();
protected ConnectionCallback m_onConnected;
+
+ private final Object m_onUnsubscribeInterfaces_mutex = new Object();
protected ConnectionCallback m_onUnsubscribeInterfaces;
+
+ private final Object m_onDisconnected_mutex = new Object();
protected ConnectionCallback m_onDisconnected;
+
+ protected final Object m_onConnectionLost_mutex = new Object();
protected ConnectionCallback m_onConnectionLost;
/**
* {@.ja PortConnectListenerホルダ}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -606,6 +606,10 @@
return 0.0;
}
ExecutionContext ec = get_actual_ec(rtc);
+ if(ec==null)
+ {
+ return 0.0;
+ }
return ec.get_rate();
}
/**
@@ -634,6 +638,10 @@
return ReturnCode_t.BAD_PARAMETER;
}
ExecutionContext ec = get_actual_ec(rtc);
+ if(ec==null)
+ {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
return ec.set_rate(rate);
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/NVUtil.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/NVUtil.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/NVUtil.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -311,7 +311,10 @@
public static Properties toProperties(final NVListHolder nvlist) {
to_prop prop = new to_prop();
prop = (to_prop) CORBA_SeqUtil.for_each(nvlist, prop);
- return prop.m_prop;
+ if(prop != null) {
+ return prop.m_prop;
+ }
+ return new Properties();
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -720,8 +720,11 @@
*/
public void clear() {
- while (this.leaf.size() > 0) {
- Properties tail = this.leaf.get(this.leaf.size() - 1);
+ while (true) {
+ if(this.leaf.size() <= 0) {
+ break;
+ }
+ Properties tail = this.leaf.lastElement();
if (tail != null) {
tail.destruct();
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java 2017-08-25 06:10:09 UTC (rev 1024)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java 2017-08-25 08:06:24 UTC (rev 1025)
@@ -44,7 +44,7 @@
* {@.en Processing at cycle of timer}
* <p>
* {@.ja invokeを起動する。}
- * {@.en Starts invoke(). }
+ * {@.en Starts invoke().}
*
* @return
* {@.ja 処理結果
@@ -55,7 +55,12 @@
* At abnormal generation:Throws out the exception.}
*/
public int svc() {
- while(m_running) {
+ while(true) {
+ synchronized (m_running_mutex) {
+ if(!m_running) {
+ break;
+ }
+ }
try {
invoke();
if( m_interval.getSec() != 0) {
@@ -82,9 +87,11 @@
* {@.en Starts the timer.}
*/
public synchronized void start(){
- if(!m_running) {
- m_running = true;
- this.open();
+ synchronized (m_running_mutex) {
+ if(!m_running) {
+ m_running = true;
+ this.open();
+ }
}
}
@@ -93,7 +100,9 @@
* {@.en Stops the timer.}
*/
public synchronized void stop() {
- m_running = false;
+ synchronized (m_running_mutex) {
+ m_running = false;
+ }
}
/**
@@ -112,12 +121,16 @@
* <li>Sets the cycle until the next starting. </ul>}
*/
public void invoke(){
- if( m_tasks==null ) m_tasks = new Vector<Task>();
- for(int intIdx=0; intIdx<m_tasks.size(); ++intIdx) {
- m_tasks.elementAt(intIdx).remains = m_tasks.elementAt(intIdx).remains.minus(m_interval);
- if( m_tasks.elementAt(intIdx).remains.sign() <= 0 ) {
- m_tasks.elementAt(intIdx).listener.invoke();
- m_tasks.elementAt(intIdx).remains = m_tasks.elementAt(intIdx).period;
+ synchronized (m_tasks_mutex) {
+ if( m_tasks==null ) m_tasks = new Vector<Task>();
+ for(int intIdx=0; intIdx<m_tasks.size(); ++intIdx) {
+ m_tasks.elementAt(intIdx).remains =
+ m_tasks.elementAt(intIdx).remains.minus(m_interval);
+ if( m_tasks.elementAt(intIdx).remains.sign() <= 0 ) {
+ m_tasks.elementAt(intIdx).listener.invoke();
+ m_tasks.elementAt(intIdx).remains =
+ m_tasks.elementAt(intIdx).period;
+ }
}
}
}
@@ -135,15 +148,17 @@
*/
public synchronized ListenerBase registerListener(ListenerBase listener, TimeValue tm) {
- if( m_tasks==null ) m_tasks = new Vector<Task>();
- for(int intIdx=0; intIdx<m_tasks.size(); ++intIdx){
- if(m_tasks.elementAt(intIdx).listener.equals(listener)) {
- m_tasks.elementAt(intIdx).period = tm;
- m_tasks.elementAt(intIdx).remains = tm;
- return listener;
+ synchronized (m_tasks_mutex) {
+ if( m_tasks==null ) m_tasks = new Vector<Task>();
+ for(int intIdx=0; intIdx<m_tasks.size(); ++intIdx){
+ if(m_tasks.elementAt(intIdx).listener.equals(listener)) {
+ m_tasks.elementAt(intIdx).period = tm;
+ m_tasks.elementAt(intIdx).remains = tm;
+ return listener;
+ }
}
+ m_tasks.add(new Task(listener, tm));
}
- m_tasks.add(new Task(listener, tm));
return listener;
}
@@ -171,10 +186,12 @@
* {@.en Listener ID}
*/
public synchronized boolean unregisterListener(ListenerBase id) {
- for(int intidx=0; intidx<m_tasks.size(); ++intidx) {
- if( m_tasks.elementAt(intidx).listener.equals(id) ) {
- m_tasks.remove(m_tasks.elementAt(intidx));
- return true;
+ synchronized (m_tasks_mutex) {
+ for(int intidx=0; intidx<m_tasks.size(); ++intidx) {
+ if( m_tasks.elementAt(intidx).listener.equals(id) ) {
+ m_tasks.remove(m_tasks.elementAt(intidx));
+ return true;
+ }
}
}
return false;
@@ -188,6 +205,7 @@
* <p>タイマー実行フラグ</p>
*/
private boolean m_running;
+ private final Object m_running_mutex = new Object();
/**
* <p>タイマー処理登録用クラス</p>
*/
@@ -205,5 +223,6 @@
* <p>タイマー処理登録クラス</p>
*/
private Vector<Task> m_tasks = new Vector<Task>();
+ private final Object m_tasks_mutex = new Object();
}
More information about the openrtm-commit
mailing list