本文整理汇总了C++中Test_var::get_num_requests方法的典型用法代码示例。如果您正苦于以下问题:C++ Test_var::get_num_requests方法的具体用法?C++ Test_var::get_num_requests怎么用?C++ Test_var::get_num_requests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test_var
的用法示例。
在下文中一共展示了Test_var::get_num_requests方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: policy_list
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var obj;
//Specify the relative round trip policy
if (rt_timeout_msecs > 0)
{
// Timeout specified in hundreds of nanoseconds which is
// 10000 milliseconds.
TimeBase::TimeT relative_rt_timeout = rt_timeout_msecs * 10000;
CORBA::Any relative_rt_timeout_as_any;
relative_rt_timeout_as_any <<= relative_rt_timeout;
CORBA::PolicyList policy_list(1);
policy_list.length(1);
policy_list[0] =
orb->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
relative_rt_timeout_as_any);
// Apply the policy at the ORB level.
obj = orb->resolve_initial_references("ORBPolicyManager");
CORBA::PolicyManager_var policy_manager =
CORBA::PolicyManager::_narrow(obj.in());
policy_manager->set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE);
// Destroy the Policy objects.
for (CORBA::ULong i = 0; i < policy_list.length(); ++i) {
policy_list[i]->destroy ();
}
policy_list.length(0);
}
///// Get object reference /////
obj = orb->resolve_initial_references("Test");
ACE_ASSERT (!CORBA::is_nil(obj.in()));
Test_var test = Test::_narrow( obj.in() );
ACE_ASSERT (!CORBA::is_nil(test.in()));
if (max_tries > 1)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Maximum number of tries = %d\n",
max_tries));
}
CORBA::Short n = 0;
for (int i = 0; i < max_tries; ++i)
{
try
{
n = test->get_num_requests (request_delay_secs);
}
catch (const CORBA::TIMEOUT &ex)
{
ex._tao_print_exception ("timeout exception:");
if (i == max_tries - 1)
throw;
}
}
if (n == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) ERROR: Expected number of requests from "
"server to be > 0\n"),
-1);
}
else
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Client got back <%d>\n",
n));
}
// In a per client situation the client has to shutdown the server
if (shutdown_server)
{
test->shutdown();
}
orb->destroy ();
return 0;
}
catch(const CORBA::Exception& ex) {
ex._tao_print_exception ("Client:");
}
return -1;
}