diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-12-08 14:10:38 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-12-08 14:10:38 -0800 |
commit | 55527152af356fda6037f836c978c2b3a2e2f045 (patch) | |
tree | d1872fe6e2d01fa15455a462df090ef94799cb5b /cpp/src/Ice/CommunicatorI.cpp | |
parent | vsplugin fxcop issues (diff) | |
download | ice-55527152af356fda6037f836c978c2b3a2e2f045.tar.bz2 ice-55527152af356fda6037f836c978c2b3a2e2f045.tar.xz ice-55527152af356fda6037f836c978c2b3a2e2f045.zip |
- bug 3533: add async version of Connection/Communicator
flushBatchRequests operation
- Slice file cleanup in C# tests
- Updating C++ dependencies
Diffstat (limited to 'cpp/src/Ice/CommunicatorI.cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index a7de37f5f5a..8e9d9b1de5c 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -11,6 +11,7 @@ #include <Ice/CommunicatorI.h> #include <Ice/Instance.h> #include <Ice/Properties.h> +#include <Ice/ConnectionFactory.h> #include <Ice/ReferenceFactory.h> #include <Ice/ProxyFactory.h> #include <Ice/ObjectFactoryManager.h> @@ -296,7 +297,62 @@ Ice::CommunicatorI::getPluginManager() const void Ice::CommunicatorI::flushBatchRequests() { - _instance->flushBatchRequests(); + AsyncResultPtr r = begin_flushBatchRequests(); + end_flushBatchRequests(r); +} + +AsyncResultPtr +Ice::CommunicatorI::begin_flushBatchRequests() +{ + return begin_flushBatchRequestsInternal(0, 0); +} + +AsyncResultPtr +Ice::CommunicatorI::begin_flushBatchRequests(const CallbackPtr& cb, const LocalObjectPtr& cookie) +{ + return begin_flushBatchRequestsInternal(cb, cookie); +} + +AsyncResultPtr +Ice::CommunicatorI::begin_flushBatchRequests(const Callback_Communicator_flushBatchRequestsPtr& cb, + const LocalObjectPtr& cookie) +{ + return begin_flushBatchRequestsInternal(cb, cookie); +} + +static const ::std::string __flushBatchRequests_name = "flushBatchRequests"; + +AsyncResultPtr +Ice::CommunicatorI::begin_flushBatchRequestsInternal(const IceInternal::CallbackBasePtr& cb, + const LocalObjectPtr& cookie) +{ + OutgoingConnectionFactoryPtr connectionFactory = _instance->outgoingConnectionFactory(); + ObjectAdapterFactoryPtr adapterFactory = _instance->objectAdapterFactory(); + + // + // This callback object receives the results of all invocations + // of Connection::begin_flushBatchRequests. + // + CommunicatorBatchOutgoingAsyncPtr result = + new CommunicatorBatchOutgoingAsync(this, _instance, __flushBatchRequests_name, cb, cookie); + + connectionFactory->flushAsyncBatchRequests(result); + adapterFactory->flushAsyncBatchRequests(result); + + // + // Inform the callback that we have finished initiating all of the + // flush requests. + // + result->ready(); + + return result; +} + +void +Ice::CommunicatorI::end_flushBatchRequests(const AsyncResultPtr& r) +{ + AsyncResult::__check(r, this, __flushBatchRequests_name); + r->__wait(); } ObjectPrx |