本文整理汇总了C++中Simple_Server_var::shutdown_now方法的典型用法代码示例。如果您正苦于以下问题:C++ Simple_Server_var::shutdown_now方法的具体用法?C++ Simple_Server_var::shutdown_now怎么用?C++ Simple_Server_var::shutdown_now使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simple_Server_var
的用法示例。
在下文中一共展示了Simple_Server_var::shutdown_now方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: callback_impl
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
if (CORBA::is_nil (poa_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize the POA.\n"),
1);
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
Simple_Server_var server =
Simple_Server::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Object reference <%s> is nil.\n",
ior),
1);
}
Callback_i callback_impl (orb.in ());
PortableServer::ObjectId_var id =
root_poa->activate_object (&callback_impl);
CORBA::Object_var object_act = root_poa->id_to_reference (id.in ());
Callback_var callback =
Callback::_narrow (object_act.in ());
for (int i = 0; i != niterations; ++i)
{
CORBA::Long r =
server->test_method (0, 0, callback.in ());
if (r != 0)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) unexpected result = %d for %d",
r, i));
}
}
if (do_abort)
{
try
{
server->shutdown_now (0);
}
catch (const CORBA::COMM_FAILURE&)
{
// Expected exception, continue....
}
}
else if (do_crash)
{
try
{
server->shutdown_now (1);
}
catch (const CORBA::COMM_FAILURE&)
{
// Expected exception, continue....
}
}
else if (do_suicide)
{
(void) server->test_method (1, 0, callback.in ());
// The shutdown callback could arrive after this twoway invocation
// returned. Wait for it shutdown callback and abort,
// otherwise it will timeout (in run_test.pl).
ACE_OS::sleep (120);
}
else if (do_self_shutdown)
{
(void) server->test_method (1, 1, callback.in ());
}
if (do_shutdown)
//.........这里部分代码省略.........