diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-06-15 09:13:51 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-06-15 09:13:51 +0200 |
commit | 145cf69b7cdd21e96d44c5bc5690f23e2e9d12fe (patch) | |
tree | 52444d61f215b1c20c08b0dc6141a327aeebb4e5 | |
parent | more BT test fixes (diff) | |
download | ice-145cf69b7cdd21e96d44c5bc5690f23e2e9d12fe.tar.bz2 ice-145cf69b7cdd21e96d44c5bc5690f23e2e9d12fe.tar.xz ice-145cf69b7cdd21e96d44c5bc5690f23e2e9d12fe.zip |
Fixed ICE-8056 - communicator waitForShutdown hang
-rw-r--r-- | cpp/src/Ice/ACM.cpp | 10 | ||||
-rw-r--r-- | csharp/src/Ice/ACM.cs | 10 | ||||
-rw-r--r-- | java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java | 16 | ||||
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java | 16 |
4 files changed, 48 insertions, 4 deletions
diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp index bb620d07430..2c5ac0da78d 100644 --- a/cpp/src/Ice/ACM.cpp +++ b/cpp/src/Ice/ACM.cpp @@ -91,6 +91,14 @@ IceInternal::FactoryACMMonitor::destroy() Lock sync(*this); if(!_instance) { + // + // Ensure all the connections have been cleared, it's important to wait here + // to prevent the timer destruction in IceInternal::Instance::destroy. + // + while(!_connections.empty()) + { + wait(); + } return; } @@ -205,7 +213,7 @@ IceInternal::FactoryACMMonitor::runTimerTask() if(!_instance) { _connections.clear(); - notify(); + notifyAll(); return; } diff --git a/csharp/src/Ice/ACM.cs b/csharp/src/Ice/ACM.cs index eb262b1e0da..bfe4417d03a 100644 --- a/csharp/src/Ice/ACM.cs +++ b/csharp/src/Ice/ACM.cs @@ -109,6 +109,14 @@ namespace IceInternal { if(_instance == null) { + // + // Ensure all the connections have been cleared, it's important to wait here + // to prevent the timer destruction in IceInternal::Instance::destroy. + // + while(_connections.Count > 0) + { + System.Threading.Monitor.Wait(this); + } return; } @@ -228,7 +236,7 @@ namespace IceInternal if(_instance == null) { _connections.Clear(); - System.Threading.Monitor.Pulse(this); + System.Threading.Monitor.PulseAll(this); return; } diff --git a/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java b/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java index 901491f966d..8d79db33f93 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java @@ -55,6 +55,20 @@ class FactoryACMMonitor implements ACMMonitor { if(_instance == null) { + // + // Ensure all the connections have been cleared, it's important to wait here + // to prevent the timer destruction in IceInternal::Instance::destroy. + // + while(!_connections.isEmpty()) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } return; } @@ -203,7 +217,7 @@ class FactoryACMMonitor implements ACMMonitor if(_instance == null) { _connections.clear(); - notify(); + notifyAll(); return; } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java index 46bf10b1733..c5ca7874b05 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java @@ -55,6 +55,20 @@ class FactoryACMMonitor implements ACMMonitor { if(_instance == null) { + // + // Ensure all the connections have been cleared, it's important to wait here + // to prevent the timer destruction in IceInternal::Instance::destroy. + // + while(!_connections.isEmpty()) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } return; } @@ -194,7 +208,7 @@ class FactoryACMMonitor implements ACMMonitor if(_instance == null) { _connections.clear(); - notify(); + notifyAll(); return; } |