diff options
Diffstat (limited to 'java/src/Ice/AsyncResult.java')
-rw-r--r-- | java/src/Ice/AsyncResult.java | 81 |
1 files changed, 36 insertions, 45 deletions
diff --git a/java/src/Ice/AsyncResult.java b/java/src/Ice/AsyncResult.java index ff78c968eca..029e191336f 100644 --- a/java/src/Ice/AsyncResult.java +++ b/java/src/Ice/AsyncResult.java @@ -243,7 +243,7 @@ public class AsyncResult } } - public final void __exceptionAsync(final LocalException ex) + public final void __invokeExceptionAsync(final LocalException ex) { // // This is called when it's not safe to call the exception callback synchronously @@ -257,7 +257,7 @@ public class AsyncResult public void run() { - __exception(ex); + __invokeException(ex); } }); } @@ -267,7 +267,7 @@ public class AsyncResult } } - public final void __exception(LocalException ex) + public final void __invokeException(LocalException ex) { synchronized(_monitor) { @@ -276,47 +276,11 @@ public class AsyncResult _exception = ex; _monitor.notifyAll(); } - - if(_callback != null) - { - if(_instance.useApplicationClassLoader()) - { - Thread.currentThread().setContextClassLoader(_callback.getClass().getClassLoader()); - } - - try - { - _callback.__completed(this); - } - catch(RuntimeException exc) - { - __warning(exc); - } - catch(AssertionError exc) - { - __error(exc); - } - catch(OutOfMemoryError exc) - { - __error(exc); - } - finally - { - if(_instance.useApplicationClassLoader()) - { - Thread.currentThread().setContextClassLoader(null); - } - } - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } + + __invokeCompleted(); } - protected final void __sentInternal() + protected final void __invokeSentInternal() { // // Note: no need to change the _state here, specializations are responsible for @@ -383,7 +347,7 @@ public class AsyncResult return _observer; } - public final void __sentAsync() + public final void __invokeSentAsync() { // // This is called when it's not safe to call the sent callback synchronously @@ -397,7 +361,7 @@ public class AsyncResult public void run() { - __sentInternal(); + __invokeSentInternal(); } }); } @@ -452,7 +416,7 @@ public class AsyncResult } } - protected final void __response() + protected final void __invokeCompleted() { // // Note: no need to change the _state here, specializations are responsible for @@ -498,6 +462,31 @@ public class AsyncResult } } + protected void + __runTimerTask() + { + IceInternal.RequestHandler handler; + synchronized(_monitor) + { + handler = _timeoutRequestHandler; + _timeoutRequestHandler = null; + } + + if(handler != null) + { + final IceInternal.RequestHandler h = handler; + _instance.clientThreadPool().execute( + new IceInternal.DispatchWorkItem(_instance) + { + public void + run() + { + h.asyncRequestTimedOut((IceInternal.OutgoingAsyncMessageCallback)AsyncResult.this); + } + }); + } + } + protected final void __warning(RuntimeException ex) { if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0) @@ -521,6 +510,8 @@ public class AsyncResult protected IceInternal.BasicStream _is; protected IceInternal.BasicStream _os; + protected IceInternal.RequestHandler _timeoutRequestHandler; + protected static final byte OK = 0x1; protected static final byte Done = 0x2; protected static final byte Sent = 0x4; |