diff options
Diffstat (limited to 'java/src/IceInternal/AsyncResultI.java')
-rw-r--r-- | java/src/IceInternal/AsyncResultI.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/java/src/IceInternal/AsyncResultI.java b/java/src/IceInternal/AsyncResultI.java index 9d7445584fe..6c31dfb8e38 100644 --- a/java/src/IceInternal/AsyncResultI.java +++ b/java/src/IceInternal/AsyncResultI.java @@ -228,17 +228,20 @@ public class AsyncResultI implements AsyncResult }); } - public void cancelable(final CancellationHandler handler) + synchronized public void cancelable(final CancellationHandler handler) { - synchronized(this) + if(_cancellationException != null) { - if(_cancellationException == null) + try { - _cancellationHandler = handler; - return; + throw _cancellationException; + } + finally + { + _cancellationException = null; } } - handler.asyncRequestCanceled((OutgoingAsyncBase)this, _cancellationException); + _cancellationHandler = handler; } public final boolean __wait() @@ -408,17 +411,6 @@ public class AsyncResultI implements AsyncResult _cancellationHandler.asyncRequestCanceled((OutgoingAsyncBase)this, ex); } - protected void checkCanceled() - { - synchronized(this) - { - if(_cancellationException != null) - { - throw _cancellationException; - } - } - } - protected Ice.Instrumentation.InvocationObserver getObserver() { return _observer; |