diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-12-17 18:06:54 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-12-17 18:06:54 +0100 |
commit | 5a57686d2ccbb085b8ac67908ad9525a6bafaf4b (patch) | |
tree | 58c2219412e8af66fbfd66d5269af6b7a48b28d2 /cpp/src/Ice/CollocatedRequestHandler.cpp | |
parent | Avoid check_output isn't supported with python 2.6 (diff) | |
download | ice-5a57686d2ccbb085b8ac67908ad9525a6bafaf4b.tar.bz2 ice-5a57686d2ccbb085b8ac67908ad9525a6bafaf4b.tar.xz ice-5a57686d2ccbb085b8ac67908ad9525a6bafaf4b.zip |
Fixed ICE-6199 - changed collocation optimization to call AMI cb asynchronously if AMD dispatch
Diffstat (limited to 'cpp/src/Ice/CollocatedRequestHandler.cpp')
-rw-r--r-- | cpp/src/Ice/CollocatedRequestHandler.cpp | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp index 8ec91cdd620..deb9fefb74d 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.cpp +++ b/cpp/src/Ice/CollocatedRequestHandler.cpp @@ -495,7 +495,7 @@ CollocatedRequestHandler::invokeAsyncBatchRequests(OutgoingAsyncBase* outAsync) } void -CollocatedRequestHandler::sendResponse(Int requestId, BasicStream* os, Byte) +CollocatedRequestHandler::sendResponse(Int requestId, BasicStream* os, Byte, bool amd) { OutgoingAsyncPtr outAsync; { @@ -533,7 +533,19 @@ CollocatedRequestHandler::sendResponse(Int requestId, BasicStream* os, Byte) if(outAsync) { - outAsync->invokeCompleted(); + // + // If called from an AMD dispatch, invoke asynchronously + // the completion callback since this might be called from + // the user code. + // + if(amd) + { + outAsync->invokeCompletedAsync(); + } + else + { + outAsync->invokeCompleted(); + } } _adapter->decDirectCount(); @@ -546,17 +558,17 @@ CollocatedRequestHandler::sendNoResponse() } bool -CollocatedRequestHandler::systemException(Int requestId, const SystemException& ex) +CollocatedRequestHandler::systemException(Int requestId, const SystemException& ex, bool amd) { - handleException(requestId, ex); + handleException(requestId, ex, amd); _adapter->decDirectCount(); return true; } void -CollocatedRequestHandler::invokeException(Int requestId, const LocalException& ex, int invokeNum) +CollocatedRequestHandler::invokeException(Int requestId, const LocalException& ex, int invokeNum, bool amd) { - handleException(requestId, ex); + handleException(requestId, ex, amd); _adapter->decDirectCount(); } @@ -640,7 +652,7 @@ CollocatedRequestHandler::invokeAll(BasicStream* os, Int requestId, Int invokeNu } catch(const ObjectAdapterDeactivatedException& ex) { - handleException(requestId, ex); + handleException(requestId, ex, false); return; } @@ -651,12 +663,12 @@ CollocatedRequestHandler::invokeAll(BasicStream* os, Int requestId, Int invokeNu } catch(const LocalException& ex) { - invokeException(requestId, ex, invokeNum); // Fatal invocation exception + invokeException(requestId, ex, invokeNum, false); // Fatal invocation exception } } void -CollocatedRequestHandler::handleException(int requestId, const Exception& ex) +CollocatedRequestHandler::handleException(int requestId, const Exception& ex, bool amd) { if(requestId == 0) { @@ -689,6 +701,18 @@ CollocatedRequestHandler::handleException(int requestId, const Exception& ex) if(outAsync) { - outAsync->invokeCompleted(); + // + // If called from an AMD dispatch, invoke asynchronously + // the completion callback since this might be called from + // the user code. + // + if(amd) + { + outAsync->invokeCompletedAsync(); + } + else + { + outAsync->invokeCompleted(); + } } } |