diff options
Diffstat (limited to 'java/src/IceInternal/Instance.java')
-rw-r--r-- | java/src/IceInternal/Instance.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index 3303a6da684..7ed0c30356d 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -273,6 +273,9 @@ public class Instance _outgoingConnectionFactory.destroy(); _outgoingConnectionFactory.waitUntilFinished(); + ThreadPool serverThreadPool = null; + ThreadPool clientThreadPool = null; + synchronized(this) { _objectAdapterFactory = null; @@ -281,14 +284,14 @@ public class Instance if(_serverThreadPool != null) { _serverThreadPool.destroy(); - _serverThreadPool.joinWithAllThreads(); + serverThreadPool = _serverThreadPool; _serverThreadPool = null; } if(_clientThreadPool != null) { _clientThreadPool.destroy(); - _clientThreadPool.joinWithAllThreads(); + clientThreadPool = _clientThreadPool; _clientThreadPool = null; } @@ -319,6 +322,19 @@ public class Instance _destroyed = true; } + + // + // Join with the thread pool threads outside the + // synchronization. + // + if(clientThreadPool != null) + { + clientThreadPool.joinWithAllThreads(); + } + if(serverThreadPool != null) + { + serverThreadPool.joinWithAllThreads(); + } } private boolean _destroyed; |