diff options
Diffstat (limited to 'java/src/IceInternal/Connection.java')
-rw-r--r-- | java/src/IceInternal/Connection.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index 53830d84a97..5275f7ef10a 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -85,7 +85,22 @@ public final class Connection extends EventHandler { try { - wait(); + if(_endpoint.timeout() >= 0) + { + long absoluteTimeoutMillis = System.currentTimeMillis() + _endpoint.timeout(); + + wait(_endpoint.timeout()); + + if(System.currentTimeMillis() >= absoluteTimeoutMillis) + { + setState(StateClosed, new Ice.CloseTimeoutException()); + // No return here, we must still wait until _transceiver becomes null. + } + } + else + { + wait(); + } } catch(InterruptedException ex) { |