本文整理汇总了C++中ice::ObjectPrxPtr::ice_invocationTimeout方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPrxPtr::ice_invocationTimeout方法的具体用法?C++ ObjectPrxPtr::ice_invocationTimeout怎么用?C++ ObjectPrxPtr::ice_invocationTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::ObjectPrxPtr
的用法示例。
在下文中一共展示了ObjectPrxPtr::ice_invocationTimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
//.........这里部分代码省略.........