本文整理汇总了C++中ConnectionIPtr::getBatchRequestQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionIPtr::getBatchRequestQueue方法的具体用法?C++ ConnectionIPtr::getBatchRequestQueue怎么用?C++ ConnectionIPtr::getBatchRequestQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionIPtr
的用法示例。
在下文中一共展示了ConnectionIPtr::getBatchRequestQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSent
void
CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con)
{
class FlushBatch : public OutgoingAsyncBase
{
public:
FlushBatch(const CommunicatorFlushBatchAsyncPtr& outAsync,
const InstancePtr& instance,
InvocationObserver& observer) :
OutgoingAsyncBase(instance), _outAsync(outAsync), _observer(observer)
{
}
virtual bool
sent()
{
_childObserver.detach();
_outAsync->check(false);
return false;
}
virtual bool
exception(const Exception& ex)
{
_childObserver.failed(ex.ice_id());
_childObserver.detach();
_outAsync->check(false);
return false;
}
virtual InvocationObserver&
getObserver()
{
return _observer;
}
virtual bool handleSent(bool, bool)
{
return false;
}
virtual bool handleException(const Ice::Exception&)
{
return false;
}
virtual bool handleResponse(bool)
{
return false;
}
virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const
{
assert(false);
}
virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const
{
assert(false);
}
virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const
{
assert(false);
}
private:
const CommunicatorFlushBatchAsyncPtr _outAsync;
InvocationObserver& _observer;
};
{
Lock sync(_m);
++_useCount;
}
try
{
OutgoingAsyncBasePtr flushBatch = ICE_MAKE_SHARED(FlushBatch, ICE_SHARED_FROM_THIS, _instance, _observer);
int batchRequestNum = con->getBatchRequestQueue()->swap(flushBatch->getOs());
if(batchRequestNum == 0)
{
flushBatch->sent();
}
else
{
con->sendAsyncRequest(flushBatch, false, false, batchRequestNum);
}
}
catch(const LocalException&)
{
check(false);
throw;
}
}