[openrtm-commit:02697] r973 - 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日 (水) 15:58:10 JST
Author: t-katami
Date: 2017-07-19 15:58:10 +0900 (Wed, 19 Jul 2017)
New Revision: 973
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Organization_impl.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.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/SDOPackage/Organization_impl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Organization_impl.java 2017-07-19 05:58:43 UTC (rev 972)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/SDOPackage/Organization_impl.java 2017-07-19 06:58:10 UTC (rev 973)
@@ -218,8 +218,10 @@
throws InvalidParameter, NotAvailable, InternalError {
rtcout.println(Logbuf.TRACE, "Organization_impl.set_organization_property()");
try {
- if( m_orgProperty==null ) m_orgProperty = new OrganizationProperty();
- synchronized (m_orgProperty) {
+ synchronized (m_org_mutex) {
+ if( m_orgProperty==null ) {
+ m_orgProperty = new OrganizationProperty();
+ }
m_orgProperty = organization_property;
return true;
}
@@ -271,10 +273,13 @@
*/
public boolean add_organization_property(final OrganizationProperty organization_property)
throws SystemException, InvalidParameter, NotAvailable, InternalError {
- rtcout.println(Logbuf.TRACE, "Organization_impl.add_organization_property()");
+ rtcout.println(Logbuf.TRACE,
+ "Organization_impl.add_organization_property()");
try {
- if( m_orgProperty==null ) m_orgProperty = new OrganizationProperty();
- synchronized (m_orgProperty) {
+ synchronized (m_org_mutex) {
+ if( m_orgProperty==null ) {
+ m_orgProperty = new OrganizationProperty();
+ }
m_orgProperty = organization_property;
return true;
}
@@ -854,6 +859,7 @@
* member:property NVList
*/
OrganizationProperty m_orgProperty = new OrganizationProperty();
+ private final java.lang.Object m_org_mutex = new java.lang.Object();
/**
* {@.ja Organization プロパティ検索用ヘルパークラス}
*/
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2017-07-19 05:58:43 UTC (rev 972)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2017-07-19 06:58:10 UTC (rev 973)
@@ -14,6 +14,7 @@
*/
public class AdjustedClock extends SystemClock {
private TimeValue m_offset;
+ private final Object m_lock = new Object();
public AdjustedClock() {
super();
@@ -21,7 +22,7 @@
}
public TimeValue getTime() {
- synchronized (m_offset) {
+ synchronized (m_lock) {
TimeValue base = super.getTime();
return base.minus(m_offset);
}
@@ -28,7 +29,7 @@
}
public boolean setTime(TimeValue clocktime) {
- synchronized (m_offset) {
+ synchronized (m_lock) {
long msec = System.currentTimeMillis();
long sec = msec/TIME_CONV_UNIT;
long usec = (msec - sec*TIME_CONV_UNIT)*TIME_CONV_UNIT;
More information about the openrtm-commit
mailing list