diff options
author | Marc Laukien <marc@zeroc.com> | 2002-05-08 16:37:26 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-05-08 16:37:26 +0000 |
commit | 790c4f92c5399d6b47d6f1c7b4e59f7957341b55 (patch) | |
tree | 8c1790429ea74de59622cb33c3d3efa84fba1de4 /java/src | |
parent | fixes (diff) | |
download | ice-790c4f92c5399d6b47d6f1c7b4e59f7957341b55.tar.bz2 ice-790c4f92c5399d6b47d6f1c7b4e59f7957341b55.tar.xz ice-790c4f92c5399d6b47d6f1c7b4e59f7957341b55.zip |
inner classes
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/ThreadPool.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java index 0281b6128a9..dd67328071d 100644 --- a/java/src/IceInternal/ThreadPool.java +++ b/java/src/IceInternal/ThreadPool.java @@ -186,7 +186,7 @@ public final class ThreadPool _threads = new EventHandlerThread[_threadNum]; for (int i = 0; i < _threadNum; i++) { - _threads[i] = new EventHandlerThread(this); + _threads[i] = new EventHandlerThread(); _threads[i].start(); } } @@ -896,21 +896,16 @@ public final class ThreadPool private RecursiveMutex _threadMutex = new RecursiveMutex(); private boolean _multipleThreads; - private final static class EventHandlerThread extends Thread + private final class EventHandlerThread extends Thread { - EventHandlerThread(ThreadPool pool) - { - _pool = pool; - } - public void run() { - BasicStream stream = new BasicStream(_pool._instance); + BasicStream stream = new BasicStream(_instance); try { - _pool.run(stream); + ThreadPool.this.run(stream); } catch (Ice.LocalException ex) { @@ -919,7 +914,7 @@ public final class ThreadPool ex.printStackTrace(pw); pw.flush(); String s = "exception in thread pool:\n" + sw.toString(); - _pool._instance.logger().error(s); + _instance.logger().error(s); } catch (RuntimeException ex) { @@ -928,13 +923,13 @@ public final class ThreadPool ex.printStackTrace(pw); pw.flush(); String s = "unknown exception in thread pool:\n" + sw.toString(); - _pool._instance.logger().error(s); + _instance.logger().error(s); } - synchronized(_pool) + synchronized(ThreadPool.this) { - --_pool._threadNum; - assert(_pool._threadNum >= 0); + --_threadNum; + assert(_threadNum >= 0); // // The notifyAll() shouldn't be needed, *except* if one of the @@ -944,9 +939,9 @@ public final class ThreadPool // "defensive" programming approach when it comes to // multithreading. // - if (_pool._threadNum == 0) + if (_threadNum == 0) { - _pool.notifyAll(); // For waitUntil...Finished() methods. + ThreadPool.this.notifyAll(); // For waitUntil...Finished() methods. } } @@ -955,13 +950,10 @@ public final class ThreadPool System.err.println("ThreadPool - run() terminated - promoting follower"); } - _pool.promoteFollower(); - _pool = null; // Break cyclic dependency. + promoteFollower(); stream.destroy(); } - - private ThreadPool _pool; } private EventHandlerThread[] _threads; private int _threadNum; // Number of running threads |