diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java b/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java index a3dd3bcb19e..583d3e4665d 100644 --- a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java +++ b/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java @@ -189,7 +189,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler return null; } - int invokeAsyncRequest(OutgoingAsyncBase outAsync, int batchRequestNum, boolean synchronous) + int invokeAsyncRequest(OutgoingAsyncBase outAsync, int batchRequestNum, boolean sync) { // // Increase the direct count to prevent the thread pool from being destroyed before @@ -221,34 +221,26 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler outAsync.attachCollocatedObserver(_adapter, requestId); - if(synchronous) + if(!sync || !_response || _reference.getInstance().queueRequests() || _reference.getInvocationTimeout() > 0) { - // - // Treat this collocated call as if it is a synchronous invocation. - // - if(!_response || _reference.getInstance().queueRequests() || _reference.getInvocationTimeout() > 0) - { - // Don't invoke from the user thread, invocation timeouts wouldn't work otherwise. - _adapter.getThreadPool().dispatch( - new InvokeAllAsync(outAsync, outAsync.getOs(), requestId, batchRequestNum)); - } - else if(_dispatcher) - { - _adapter.getThreadPool().dispatchFromThisThread( - new InvokeAllAsync(outAsync, outAsync.getOs(), requestId, batchRequestNum)); - } - else // Optimization: directly call invokeAll if there's no dispatcher. - { - if(sentAsync(outAsync)) - { - invokeAll(outAsync.getOs(), requestId, batchRequestNum); - } - } + _adapter.getThreadPool().dispatch(new InvokeAllAsync(outAsync, + outAsync.getOs(), + requestId, + batchRequestNum)); } - else + else if(_dispatcher) { - _adapter.getThreadPool().dispatch( - new InvokeAllAsync(outAsync, outAsync.getOs(), requestId, batchRequestNum)); + _adapter.getThreadPool().dispatchFromThisThread(new InvokeAllAsync(outAsync, + outAsync.getOs(), + requestId, + batchRequestNum)); + } + else // Optimization: directly call invokeAll if there's no dispatcher. + { + if(sentAsync(outAsync)) + { + invokeAll(outAsync.getOs(), requestId, batchRequestNum); + } } return AsyncStatus.Queued; } |