Exemple #1
0
void
CommunicatorFlushBatch::flushConnection(const ConnectionIPtr& con)
{
    class FlushBatch : public OutgoingAsyncBase
    {
    public:
        
        FlushBatch(const CommunicatorFlushBatchPtr& outAsync, 
                   const InstancePtr& instance, 
                   InvocationObserver& observer) :
            OutgoingAsyncBase(outAsync->getCommunicator(), instance, outAsync->getOperation(), __dummyCallback, 0),
            _outAsync(outAsync), 
            _observer(observer)
        {
        }

        virtual bool sent()
        {
            _childObserver.detach();
            _outAsync->check(false);
            return false;
        }

        virtual bool completed(const Exception& ex)
        {
            _childObserver.failed(ex.ice_name());
            _childObserver.detach();
            _outAsync->check(false);
            return false;
        }

    private:

        virtual InvocationObserver& getObserver()
        {
            return _observer;
        }

        const CommunicatorFlushBatchPtr _outAsync;
        InvocationObserver& _observer;
    };

    {
        IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
        ++_useCount;
    }

    try
    {
        con->flushAsyncBatchRequests(new FlushBatch(this, _instance, _observer));
    }
    catch(const LocalException&)
    {
        check(false);
        throw;
    }
}
Exemple #2
0
AsyncStatus
ProxyFlushBatch::send(const ConnectionIPtr& connection, bool, bool)
{
    _cachedConnection = connection;
    return connection->flushAsyncBatchRequests(this);
}