summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/CollocatedRequestHandler.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-12-17 18:06:54 +0100
committerBenoit Foucher <benoit@zeroc.com>2014-12-17 18:06:54 +0100
commit5a57686d2ccbb085b8ac67908ad9525a6bafaf4b (patch)
tree58c2219412e8af66fbfd66d5269af6b7a48b28d2 /cpp/src/Ice/CollocatedRequestHandler.cpp
parentAvoid check_output isn't supported with python 2.6 (diff)
downloadice-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.cpp44
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();
+ }
}
}