diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-10-15 17:26:45 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-10-15 17:26:45 +0200 |
commit | f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2 (patch) | |
tree | 6b12ef2c59421702743048393f4757c0d1e0c504 /java/src/IceInternal/ProxyOutgoingAsyncBase.java | |
parent | ICE-5732 missing tracing in throughput demo (diff) | |
download | ice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.tar.bz2 ice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.tar.xz ice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.zip |
Fixed ICE-5666: setting the invocation timeout to -2 provides the previous connection timeouts
Diffstat (limited to 'java/src/IceInternal/ProxyOutgoingAsyncBase.java')
-rw-r--r-- | java/src/IceInternal/ProxyOutgoingAsyncBase.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/java/src/IceInternal/ProxyOutgoingAsyncBase.java b/java/src/IceInternal/ProxyOutgoingAsyncBase.java index 0441552fb45..29779078111 100644 --- a/java/src/IceInternal/ProxyOutgoingAsyncBase.java +++ b/java/src/IceInternal/ProxyOutgoingAsyncBase.java @@ -66,6 +66,27 @@ public abstract class ProxyOutgoingAsyncBase extends OutgoingAsyncBase invokeImpl(false); } + public void cancelable(final CancellationHandler handler) + { + if(_proxy.__reference().getInvocationTimeout() == -2 && _cachedConnection != null) + { + final int timeout = _cachedConnection.timeout(); + if(timeout > 0) + { + _future = _instance.timer().schedule( + new Runnable() + { + @Override + public void run() + { + cancel(new Ice.ConnectionTimeoutException()); + } + }, timeout, java.util.concurrent.TimeUnit.MILLISECONDS); + } + } + super.cancelable(handler); + } + public void abort(Ice.Exception ex) { assert(_childObserver == null); @@ -128,15 +149,14 @@ public abstract class ProxyOutgoingAsyncBase extends OutgoingAsyncBase { @Override public void run() - { - cancel(new Ice.InvocationTimeoutException()); - } + { + cancel(new Ice.InvocationTimeoutException()); + } }, invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS); } } else // If not called from the user thread, it's called from the retry queue { - checkCanceled(); // Cancellation exception aren't retriable if(_observer != null) { _observer.retried(); @@ -190,7 +210,6 @@ public abstract class ProxyOutgoingAsyncBase extends OutgoingAsyncBase } else if(_observer != null) { - checkCanceled(); _observer.retried(); } } |