diff options
Diffstat (limited to 'java/test/Ice/dispatcher/Dispatcher.java')
-rw-r--r-- | java/test/Ice/dispatcher/Dispatcher.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/java/test/Ice/dispatcher/Dispatcher.java b/java/test/Ice/dispatcher/Dispatcher.java index 9b6218c7c8f..0ae05491f4f 100644 --- a/java/test/Ice/dispatcher/Dispatcher.java +++ b/java/test/Ice/dispatcher/Dispatcher.java @@ -22,8 +22,6 @@ public class Dispatcher implements Runnable, Ice.Dispatcher public Dispatcher() { - assert(_instance == null); - _instance = this; _thread = new Thread(this); _thread.start(); } @@ -84,19 +82,19 @@ public class Dispatcher implements Runnable, Ice.Dispatcher } } - static public void + public void terminate() { - synchronized(_instance) + synchronized(this) { - _instance._terminated = true; - _instance.notify(); + _terminated = true; + notify(); } while(true) { try { - _instance._thread.join(); + _thread.join(); break; } catch(java.lang.InterruptedException ex) @@ -105,15 +103,13 @@ public class Dispatcher implements Runnable, Ice.Dispatcher } } - static public boolean + public boolean isDispatcherThread() { - return Thread.currentThread() == _instance._thread; + return Thread.currentThread() == _thread; } - static Dispatcher _instance; - private java.util.Queue<Runnable> _calls = new java.util.LinkedList<Runnable>(); - Thread _thread; - boolean _terminated = false; -}; + private Thread _thread; + private boolean _terminated = false; +} |