[openrtm-commit:00548] r622 - trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 1月 5日 (木) 17:54:40 JST
Author: fsi-katami
Date: 2012-01-05 17:54:39 +0900 (Thu, 05 Jan 2012)
New Revision: 622
Modified:
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
Log:
Fixed the bug that shutdwon is not done when disabling it with the timer. CTRL-C was hooking done.
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2011-12-28 06:25:08 UTC (rev 621)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2012-01-05 08:54:39 UTC (rev 622)
@@ -46,6 +46,19 @@
*/
public class Manager {
+ private class SignalAction extends Thread {
+ public SignalAction() {
+ super();
+ }
+ public void run(){
+ terminate();
+ try {
+ Thread.sleep(100);
+ }catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
/**
* {@.ja コンストラクタ。}
* {@.en Constructor}
@@ -61,6 +74,7 @@
rtcout = new Logbuf("Manager");
m_runner = null;
m_terminator = null;
+ Runtime.getRuntime().addShutdownHook(new SignalAction());
}
/**
@@ -81,6 +95,7 @@
rtcout = new Logbuf("Manager");
m_runner = null;
m_terminator = null;
+ Runtime.getRuntime().addShutdownHook(new SignalAction());
}
/**
@@ -1132,7 +1147,26 @@
synchronized (m_finalized.mutex){
m_finalized.comps.add(comp);
}
+ if (m_timer == null) {
+ cleanupComponents_();
+ }
}
+
+ private void cleanupComponents_() {
+ m_finalizer.exec();
+ }
+ protected class Finalizer implements Runnable {
+ public Finalizer(){
+ }
+ public void exec(){
+ Thread t = new Thread(this);
+ t.start();
+ }
+ public void run(){
+ m_cleanupComponents.doOperate();
+ }
+ }
+ private Finalizer m_finalizer = new Finalizer();
/**
* <p> procComponentArgs </p>
*
@@ -1912,7 +1946,9 @@
protected void shutdownManager() {
rtcout.println(Logbuf.TRACE, "Manager.shutdownManager()");
- m_timer.stop();
+ if (m_timer != null) {
+ m_timer.stop();
+ }
}
/**
* {@.ja Manager の終了のためのリスナークラス}
@@ -2445,7 +2481,7 @@
rtcout.println(Logbuf.DEBUG, "ORB was shutdown.");
rtcout.println(Logbuf.DEBUG, "ORB was destroied.");
- m_pORB.destroy();
+ //m_pORB.destroy();
m_pORB = null;
ORBUtil.clearOrb();
openrtm-commit メーリングリストの案内