diff options
-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; } |