diff options
author | Marc Laukien <marc@zeroc.com> | 2003-08-28 20:33:29 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2003-08-28 20:33:29 +0000 |
commit | fae5803f20d2719a1e146828aa23b1bd9b9a9d04 (patch) | |
tree | 39b19d3cac3b15da6b7621867e2e7bf896cf3d62 /java/src/IceInternal/Connection.java | |
parent | Switched server implementation to use ties (diff) | |
download | ice-fae5803f20d2719a1e146828aa23b1bd9b9a9d04.tar.bz2 ice-fae5803f20d2719a1e146828aa23b1bd9b9a9d04.tar.xz ice-fae5803f20d2719a1e146828aa23b1bd9b9a9d04.zip |
connection closure timeout
Diffstat (limited to 'java/src/IceInternal/Connection.java')
-rw-r--r-- | java/src/IceInternal/Connection.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index 002e242f4e7..6067cd2ec85 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -81,18 +81,32 @@ public final class Connection extends EventHandler public synchronized void waitUntilFinished() { - while(_transceiver != null || _dispatchCount > 0) + // + // We wait indefinitely until all outstanding requests are + // completed. Otherwise we couldn't guarantee that there are + // no outstanding calls when deactivate() is called on the + // servant locators. + // + while(_dispatchCount > 0) { try { - // - // We wait indefinitely until all outstanding requests are - // completed. If we were using a timeout here we couldn't - // guarantee that there are no outstanding calls when - // deactivate() is called on the servant locators. - // wait(); -/* + } + catch(InterruptedException ex) + { + } + + } + + // + // Now we must wait for connection closure. If there is a + // timeout, we force the connection closure. + // + while(_transceiver != null) + { + try + { if(_endpoint.timeout() >= 0) { long absoluteTimeoutMillis = System.currentTimeMillis() + _endpoint.timeout(); @@ -102,7 +116,6 @@ public final class Connection extends EventHandler if(System.currentTimeMillis() >= absoluteTimeoutMillis) { setState(StateClosed, new Ice.CloseTimeoutException()); - assert(_dispatchCount == 0); // No return here, we must still wait until _transceiver becomes null. } } @@ -110,7 +123,6 @@ public final class Connection extends EventHandler { wait(); } -*/ } catch(InterruptedException ex) { |