本文整理汇总了C++中TestIntfPrx::begin_abort方法的典型用法代码示例。如果您正苦于以下问题:C++ TestIntfPrx::begin_abort方法的具体用法?C++ TestIntfPrx::begin_abort怎么用?C++ TestIntfPrx::begin_abort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestIntfPrx
的用法示例。
在下文中一共展示了TestIntfPrx::begin_abort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
{
cout << "testing stringToProxy... " << flush;
ostringstream ref;
ref << "test";
for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p)
{
ref << ":default -p " << *p;
}
Ice::ObjectPrx base = communicator->stringToProxy(ref.str());
test(base);
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrx obj = TestIntfPrx::checkedCast(base);
test(obj);
test(obj == base);
cout << "ok" << endl;
int oldPid = 0;
bool ami = false;
for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j)
{
if(j > 3)
{
j = 0;
ami = !ami;
}
if(!ami)
{
cout << "testing server #" << i << "... " << flush;
int pid = obj->pid();
test(pid != oldPid);
cout << "ok" << endl;
oldPid = pid;
}
else
{
cout << "testing server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback();
obj->begin_pid(newCallback_TestIntf_pid(cb, &Callback::opPidI, &Callback::exception));
cb->check();
int pid = cb->pid();
test(pid != oldPid);
cout << "ok" << endl;
oldPid = pid;
}
if(j == 0)
{
if(!ami)
{
cout << "shutting down server #" << i << "... " << flush;
obj->shutdown();
cout << "ok" << endl;
}
else
{
cout << "shutting down server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_shutdown(newCallback_TestIntf_shutdown(cb, &Callback::opShutdownI, &Callback::exception));
cb->check();
cout << "ok" << endl;
}
}
else if(j == 1 || i + 1 > ports.size())
{
if(!ami)
{
cout << "aborting server #" << i << "... " << flush;
try
{
obj->abort();
test(false);
}
catch(const Ice::ConnectionLostException&)
{
cout << "ok" << endl;
}
catch(const Ice::ConnectFailedException&)
{
cout << "ok" << endl;
}
}
else
{
cout << "aborting server #" << i << " with AMI... " << flush;
CallbackPtr cb = new Callback;
obj->begin_abort(newCallback_TestIntf_abort(cb, &Callback::response, &Callback::exceptAbortI));
cb->check();
cout << "ok" << endl;
}
}
else if(j == 2 || j == 3)
{
if(!ami)
{
cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent call... " << flush;
//.........这里部分代码省略.........