summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-06-23 15:27:03 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-06-23 15:27:03 +0200
commitd9fd16f6427706e790c3228f712642626e71e783 (patch)
tree43009dbaa7cfd8ff04e5d4b463fa54fc2702b4b6 /java
parentFixed ICE-7979 - Ice/ami server shutdown hang (diff)
downloadice-d9fd16f6427706e790c3228f712642626e71e783.tar.bz2
ice-d9fd16f6427706e790c3228f712642626e71e783.tar.xz
ice-d9fd16f6427706e790c3228f712642626e71e783.zip
Another fix for ICE-7979 - Ice/ami server shutdown hang
Diffstat (limited to 'java')
-rw-r--r--java/test/src/main/java/test/Ice/ami/TestI.java39
1 files changed, 26 insertions, 13 deletions
diff --git a/java/test/src/main/java/test/Ice/ami/TestI.java b/java/test/src/main/java/test/Ice/ami/TestI.java
index 9efb73bc187..d7d6c49a861 100644
--- a/java/test/src/main/java/test/Ice/ami/TestI.java
+++ b/java/test/src/main/java/test/Ice/ami/TestI.java
@@ -178,8 +178,19 @@ public class TestI implements TestIntf
public synchronized CompletionStage<Void>
startDispatchAsync(com.zeroc.Ice.Current current)
{
+ if(_shutdown)
+ {
+ // Ignore, this can occur with the forcefull connection close test, shutdown can be dispatch
+ // before start dispatch.
+ CompletableFuture<Void> v = new CompletableFuture<>();
+ v.complete(null);
+ return v;
+ }
+ else if(_pending != null)
+ {
+ _pending.complete(null);
+ }
_pending = new CompletableFuture<>();
- notifyAll();
return _pending;
}
@@ -187,29 +198,31 @@ public class TestI implements TestIntf
public synchronized void
finishDispatch(com.zeroc.Ice.Current current)
{
- while(_pending == null)
+ if(_shutdown)
{
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
-
+ return;
+ }
+ else if(_pending != null) // Pending might not be set yet if startDispatch is dispatch out-of-order
+ {
+ _pending.complete(null);
+ _pending = null;
}
- _pending.complete(null);
- _pending = null;
}
@Override
public synchronized void
shutdown(com.zeroc.Ice.Current current)
{
- assert(_pending == null);
+ _shutdown = true;
+ if(_pending != null)
+ {
+ _pending.complete(null);
+ _pending = null;
+ }
current.adapter.getCommunicator().shutdown();
}
private int _batchCount;
+ private boolean _shutdown = false;
private CompletableFuture<Void> _pending = null;
}