[openrtm-commit:02696] r972 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC: . SDOPackage util/clock
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 7月 19日 (水) 14:58:43 JST
Author: t-katami
Date: 2017-07-19 14:58:43 +0900 (Wed, 19 Jul 2017)
New Revision: 972
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTask.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTaskFactory.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/util/clock/LogicalClock.java
Log:
[compat,bugfix,->RELENG_1_2] Fixed the item pointed out by the static code analysis tool.
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTask.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTask.java 2017-07-19 03:00:03 UTC (rev 971)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTask.java 2017-07-19 05:58:43 UTC (rev 972)
@@ -445,8 +445,8 @@
if (m_periodCount > m_periodCountMax) {
synchronized (m_periodStat.mutex) {
m_periodStat.stat = m_periodTime.getStatistics();
- m_periodCount = 0;
}
+ m_periodCount = 0;
}
++m_periodCount;
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTaskFactory.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTaskFactory.java 2017-07-19 03:00:03 UTC (rev 971)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/PeriodicTaskFactory.java 2017-07-19 05:58:43 UTC (rev 972)
@@ -25,16 +25,12 @@
* {@.en PeriodicTaskFactory object}
*
*/
- public static PeriodicTaskFactory instance() {
+ synchronized public static PeriodicTaskFactory instance() {
if (factory_global == null) {
- synchronized (factory_global_mutex) {
- if (factory_global == null) {
- try {
- factory_global = new PeriodicTaskFactory();
- } catch (Exception e) {
- factory_global = null;
- }
- }
+ try {
+ factory_global = new PeriodicTaskFactory();
+ } catch (Exception e) {
+ factory_global = null;
}
}
@@ -41,10 +37,6 @@
return factory_global;
}
/**
- * <p> mutex </p>
- */
- private static String factory_global_mutex = new String();
- /**
* <p> object </p>
*/
private static PeriodicTaskFactory factory_global;
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-07-19 03:00:03 UTC (rev 971)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Configuration_impl.java 2017-07-19 05:58:43 UTC (rev 972)
@@ -419,19 +419,21 @@
public Parameter[] get_configuration_parameters()
throws NotAvailable, InternalError {
- rtcout.println(Logbuf.TRACE, "Configuration_impl.get_configurations()");
+ rtcout.println(Logbuf.TRACE,
+ "Configuration_impl.get_configuration_parameters()");
try{
- if( m_parameters==null ) {
- m_parameters = new ParameterListHolder();
- m_parameters.value = new Parameter[0];
- }
- synchronized (m_parameters) {
+ synchronized (m_parameters_lock) {
+ if( m_parameters==null ) {
+ m_parameters = new ParameterListHolder();
+ m_parameters.value = new Parameter[0];
+ }
ParameterListHolder param = new ParameterListHolder(m_parameters.value);
return param.value;
}
} catch (Exception ex) {
- throw new InternalError("Configuration::get_configuration_parameters()");
+ throw new InternalError(
+ "Configuration::get_configuration_parameters()");
}
}
@@ -1032,6 +1034,7 @@
* {@.en List of Parameter}
*/
protected ParameterListHolder m_parameters;
+ protected final String m_parameters_lock = new String();
/**
* {@.ja コンフィギュレーションセット情報}
* {@.en Information of configuration set}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java 2017-07-19 03:00:03 UTC (rev 971)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java 2017-07-19 05:58:43 UTC (rev 972)
@@ -8,7 +8,7 @@
*
* <p>
* {@.ja このクラスは論理時間を設定または取得するクラスである。
-* 単純に settime() によって設定された時刻を gettime() によって取得する。}
+ * 単純に settime() によって設定された時刻を gettime() によって取得する。}
* {@.en This class sets and gets system clock.
* It just sets time by settime() and gets time by gettime().}
*/
@@ -15,6 +15,7 @@
public class LogicalClock implements IClock {
private TimeValue m_currentTime;
+ private final Object m_lock = new Object();
public LogicalClock() {
m_currentTime = new TimeValue(0.0);
@@ -21,13 +22,13 @@
}
public TimeValue getTime() {
- synchronized (m_currentTime) {
+ synchronized (m_lock) {
return m_currentTime;
}
}
public boolean setTime(TimeValue clocktime) {
- synchronized (m_currentTime) {
+ synchronized (m_lock) {
m_currentTime = clocktime;
}
return true;
More information about the openrtm-commit
mailing list