本文整理汇总了C++中ice::ObjectPrxPtr::ice_timeout方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPrxPtr::ice_timeout方法的具体用法?C++ ObjectPrxPtr::ice_timeout怎么用?C++ ObjectPrxPtr::ice_timeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::ObjectPrxPtr
的用法示例。
在下文中一共展示了ObjectPrxPtr::ice_timeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sync
vector<EndpointIPtr>
IceInternal::RouterInfo::setClientEndpoints(const Ice::ObjectPrxPtr& proxy)
{
IceUtil::Mutex::Lock sync(*this);
if(_clientEndpoints.empty())
{
if(!proxy)
{
//
// If getClientProxy() return nil, use router endpoints.
//
_clientEndpoints = _router->__reference()->getEndpoints();
}
else
{
Ice::ObjectPrxPtr clientProxy = proxy->ice_router(0); // The client proxy cannot be routed.
//
// In order to avoid creating a new connection to the router,
// we must use the same timeout as the already existing
// connection.
//
if(_router->ice_getConnection())
{
clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
}
_clientEndpoints = clientProxy->__reference()->getEndpoints();
}
}
return _clientEndpoints;
}
示例2: seq
TimeoutPrxPtr
allTests(const Ice::CommunicatorPtr& communicator)
{
string sref = "timeout:" + getTestEndpoint(communicator, 0);
Ice::ObjectPrxPtr obj = communicator->stringToProxy(sref);
test(obj);
TimeoutPrxPtr timeout = ICE_CHECKED_CAST(TimeoutPrx, obj);
test(timeout);
cout << "testing connect timeout... " << flush;
{
//
// Expect ConnectTimeoutException.
//
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(100));
timeout->holdAdapter(500);
try
{
to->op();
test(false);
}
catch(const Ice::ConnectTimeoutException&)
{
// Expected.
}
}
{
//
// Expect success.
//
timeout->op(); // Ensure adapter is active.
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(1000));
timeout->holdAdapter(500);
try
{
to->op();
}
catch(const Ice::ConnectTimeoutException&)
{
test(false);
}
}
cout << "ok" << endl;
// The sequence needs to be large enough to fill the write/recv buffers
ByteSeq seq(2000000);
cout << "testing connection timeout... " << flush;
{
//
// Expect TimeoutException.
//
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(100));
timeout->holdAdapter(500);
try
{
to->sendData(seq);
test(false);
}
catch(const Ice::TimeoutException&)
{
// Expected.
}
}
{
//
// Expect success.
//
timeout->op(); // Ensure adapter is active.
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(1000));
timeout->holdAdapter(500);
try
{
ByteSeq seq(1000000);
to->sendData(seq);
}
catch(const Ice::TimeoutException&)
{
test(false);
}
}
cout << "ok" << endl;
cout << "testing invocation timeout... " << flush;
{
Ice::ConnectionPtr connection = obj->ice_getConnection();
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_invocationTimeout(100));
test(connection == to->ice_getConnection());
try
{
to->sleep(750);
test(false);
}
catch(const Ice::InvocationTimeoutException&)
{
}
obj->ice_ping();
to = ICE_CHECKED_CAST(TimeoutPrx, obj->ice_invocationTimeout(500));
test(connection == to->ice_getConnection());
//.........这里部分代码省略.........