diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-06-13 14:39:41 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-06-13 14:39:41 +0200 |
commit | c43d26cb98eb2ab48910f96600b9f402a15af499 (patch) | |
tree | fde5db315a9d2da61235938f70c0be38cadc0bf1 /java-compat/src | |
parent | Only install zeroc.ice.v140 when ICE_BIN_DIST == cpp (diff) | |
download | ice-c43d26cb98eb2ab48910f96600b9f402a15af499.tar.bz2 ice-c43d26cb98eb2ab48910f96600b9f402a15af499.tar.xz ice-c43d26cb98eb2ab48910f96600b9f402a15af499.zip |
Another fix for ICE-8015 - clearing connections from ACM monitor
Diffstat (limited to 'java-compat/src')
-rw-r--r-- | java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java | 36 |
1 files changed, 36 insertions, 0 deletions
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 79cb7b200ef..901491f966d 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java @@ -57,8 +57,42 @@ class FactoryACMMonitor implements ACMMonitor { return; } + + if(!_connections.isEmpty()) + { + // + // Cancel the scheduled timer task and schedule it again now to clear the + // connection set from the timer thread. + // + assert(_future != null); + _future.cancel(false); + _future = null; + + _instance.timer().schedule(new Runnable() { + @Override + public void run() + { + monitorConnections(); + } + }, 0, java.util.concurrent.TimeUnit.MILLISECONDS); + } + _instance = null; _changes.clear(); + + // + // Wait for the connection set to be cleared by the timer thread. + // + while(!_connections.isEmpty()) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } } @Override @@ -72,6 +106,7 @@ class FactoryACMMonitor implements ACMMonitor synchronized(this) { + assert(_instance != null); if(_connections.isEmpty()) { _connections.add(connection); @@ -168,6 +203,7 @@ class FactoryACMMonitor implements ACMMonitor if(_instance == null) { _connections.clear(); + notify(); return; } |