diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 11:17:34 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 11:17:34 +0100 |
commit | 18ab8207bd14def950fd399c60d9ee54fab75d3b (patch) | |
tree | a82af333127184acc6be6e0969919cb20be5e8b3 /cpp/src/Ice/Proxy.cpp | |
parent | Fixed ICE-7548 - getAdminProxy no longer returns 0 if synchronization is in p... (diff) | |
download | ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.bz2 ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.xz ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.zip |
Fixed ICE-7169 and ICE-7375 - add option to specify if batch requests flushed with the communicator/connection should be compressed
Diffstat (limited to 'cpp/src/Ice/Proxy.cpp')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 4c36e74e369..2535c05c1e4 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -14,6 +14,7 @@ #include <Ice/ObjectAdapterFactory.h> #include <Ice/OutgoingAsync.h> #include <Ice/Reference.h> +#include <Ice/CollocatedRequestHandler.h> #include <Ice/EndpointI.h> #include <Ice/Instance.h> #include <Ice/RouterInfo.h> @@ -48,6 +49,93 @@ const string ice_flushBatchRequests_name = "ice_flushBatchRequests"; } +ProxyFlushBatchAsync::ProxyFlushBatchAsync(const ObjectPrxPtr& proxy) : ProxyOutgoingAsyncBase(proxy) +{ +} + +AsyncStatus +ProxyFlushBatchAsync::invokeRemote(const ConnectionIPtr& connection, bool compress, bool) +{ + if(_batchRequestNum == 0) + { + if(sent()) + { + return static_cast<AsyncStatus>(AsyncStatusSent | AsyncStatusInvokeSentCallback); + } + else + { + return AsyncStatusSent; + } + } + _cachedConnection = connection; + return connection->sendAsyncRequest(ICE_SHARED_FROM_THIS, compress, false, _batchRequestNum); +} + +AsyncStatus +ProxyFlushBatchAsync::invokeCollocated(CollocatedRequestHandler* handler) +{ + if(_batchRequestNum == 0) + { + if(sent()) + { + return static_cast<AsyncStatus>(AsyncStatusSent | AsyncStatusInvokeSentCallback); + } + else + { + return AsyncStatusSent; + } + } + return handler->invokeAsyncRequest(this, _batchRequestNum, false); +} + +void +ProxyFlushBatchAsync::invoke(const string& operation) +{ + checkSupportedProtocol(getCompatibleProtocol(_proxy->_getReference()->getProtocol())); + _observer.attach(_proxy, operation, ::Ice::noExplicitContext); + bool compress; // Ignore for proxy flushBatchRequests + _batchRequestNum = _proxy->_getBatchRequestQueue()->swap(&_os, compress); + invokeImpl(true); // userThread = true +} + +ProxyGetConnection::ProxyGetConnection(const ObjectPrxPtr& prx) : ProxyOutgoingAsyncBase(prx) +{ +} + +AsyncStatus +ProxyGetConnection::invokeRemote(const ConnectionIPtr& connection, bool, bool) +{ + _cachedConnection = connection; + if(responseImpl(true)) + { + invokeResponseAsync(); + } + return AsyncStatusSent; +} + +AsyncStatus +ProxyGetConnection::invokeCollocated(CollocatedRequestHandler*) +{ + if(responseImpl(true)) + { + invokeResponseAsync(); + } + return AsyncStatusSent; +} + +Ice::ConnectionPtr +ProxyGetConnection::getConnection() const +{ + return _cachedConnection; +} + +void +ProxyGetConnection::invoke(const string& operation) +{ + _observer.attach(_proxy, operation, ::Ice::noExplicitContext); + invokeImpl(true); // userThread = true +} + #ifdef ICE_CPP11_MAPPING // C++11 mapping namespace Ice |