[openrtm-commit:02730] r995 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: RTMExamples/SeqIO/view jp/go/aist/rtm/RTC jp/go/aist/rtm/RTC/SDOPackage jp/go/aist/rtm/RTC/executionContext jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 8月 8日 (火) 17:12:03 JST
Author: t-katami
Date: 2017-08-08 17:12:03 +0900 (Tue, 08 Aug 2017)
New Revision: 995
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.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/SDOPackage/Configuration_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/util/Timer.java
Log:
[compat,bugfix,->RELENG_1_2] Fixed the items pointed out by the static code analysis tool.
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java 2017-08-08 05:57:15 UTC (rev 994)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SeqIO/view/SeqViewApp.java 2017-08-08 08:12:03 UTC (rev 995)
@@ -89,11 +89,15 @@
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);
+ }
}
synchronized (_longValMarked_mutex) {
if (_longValMarked) {
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-08-08 05:57:15 UTC (rev 994)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-08-08 08:12:03 UTC (rev 995)
@@ -275,9 +275,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;
+ }
}
/**
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java 2017-08-08 05:57:15 UTC (rev 994)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java 2017-08-08 08:12:03 UTC (rev 995)
@@ -951,7 +951,7 @@
rtcout.println(Logbuf.TRACE, "Configuration_impl.getDeviceProfile()");
- synchronized(m_deviceProfile){
+ synchronized(m_device_profile_lock){
return m_deviceProfile;
}
}
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-08-08 05:57:15 UTC (rev 994)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextWorker.java 2017-08-08 08:12:03 UTC (rev 995)
@@ -77,7 +77,9 @@
*/
public boolean isRunning() {
rtcout.println(Logbuf.TRACE, "isRunning()");
- return m_running;
+ synchronized (m_mutex){
+ return m_running;
+ }
}
/**
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java 2017-08-08 05:57:15 UTC (rev 994)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Timer.java 2017-08-08 08:12:03 UTC (rev 995)
@@ -87,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();
+ }
}
}
@@ -98,7 +100,9 @@
* {@.en Stops the timer.}
*/
public synchronized void stop() {
- m_running = false;
+ synchronized (m_running_mutex) {
+ m_running = false;
+ }
}
/**
@@ -117,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;
+ }
}
}
}
@@ -140,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;
}
@@ -176,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;
@@ -192,8 +204,8 @@
/**
* <p>タイマー実行フラグ</p>
*/
+ private boolean m_running;
private final Object m_running_mutex = new Object();
- private boolean m_running;
/**
* <p>タイマー処理登録用クラス</p>
*/
@@ -211,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