Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_2074_Regression / ORB_Task.cpp
blobc3e99f7402e43c0640d8fb596feee563afea2ba3
1 /**
2 * @file ORB_Task.cpp
4 * @author Carlos O'Ryan <coryan@atdesk.com>
5 */
6 #include "ORB_Task.h"
7 #include "tao/Messaging/Messaging.h"
8 #include "orbsvcs/CosNamingC.h"
12 ORB_Task::ORB_Task (CORBA::ORB_ptr orb)
13 : orb_ (CORBA::ORB::_duplicate (orb))
17 int
18 ORB_Task::svc (void)
20 try
22 CORBA::Object_var ncRef =
23 orb_->string_to_object(
24 "corbaloc:iiop:10.175.12.99:15025/NameService" );
26 CORBA::PolicyList policies;
28 TimeBase::TimeT timeout = 5000 * 10000;
30 CORBA::Any timeoutAny;
31 timeoutAny <<= timeout;
33 policies.length(1);
34 policies[0] = orb_->create_policy(
35 Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
36 timeoutAny );
38 CORBA::Object_var object = ncRef->_set_policy_overrides(
39 policies, CORBA::SET_OVERRIDE );
41 policies[0]->destroy();
43 CosNaming::NamingContext_var namingContext =
44 CosNaming::NamingContext::_narrow( object.in() );
45 namingContext->_non_existent();
47 catch ( const CORBA::TRANSIENT&)
49 ACE_DEBUG ((LM_DEBUG, "Caught transient\n"));
51 catch ( const CORBA::TIMEOUT&)
53 ACE_DEBUG ((LM_DEBUG, "Caught timeout\n"));
55 catch ( const CORBA::Exception& e )
57 e._tao_print_exception ("Exception caught");
60 return 0;