diff options
Diffstat (limited to 'java/src/Ice/ConnectionI.java')
-rw-r--r-- | java/src/Ice/ConnectionI.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index 0cc19e74530..18fc01d28eb 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -244,6 +244,32 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne } else { + // + // If we do a graceful shutdown, then we wait until all + // outstanding requests have been completed. Otherwise, + // the CloseConnectionException will cause all outstanding + // requests to be retried, regardless of whether the + // server has processed them or not. + // + // For consistency, we also wait until batch requests have + // completed, and, if this is a server connection, all + // requests have been dispatched. These are the same + // criteria that we use to determine whether ACM may close + // this connection. + // + while(!_requests.isEmpty() || !_asyncRequests.isEmpty() || + _batchStreamInUse || !_batchStream.isEmpty() || + _dispatchCount != 0) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + setState(StateClosing, new CloseConnectionException()); } } |