Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_2074_Regression / ORB_Task.cpp
blob8f6b6f604db7f38bead59898751845878ed60bdd
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"
11 ORB_Task::ORB_Task (CORBA::ORB_ptr orb)
12 : orb_ (CORBA::ORB::_duplicate (orb))
16 int
17 ORB_Task::svc ()
19 try
21 CORBA::Object_var ncRef =
22 orb_->string_to_object(
23 "corbaloc:iiop:10.175.12.99:15025/NameService");
25 CORBA::PolicyList policies;
27 TimeBase::TimeT timeout = 5000 * 10000;
29 CORBA::Any timeoutAny;
30 timeoutAny <<= timeout;
32 policies.length(1);
33 policies[0] = orb_->create_policy(
34 Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, timeoutAny);
36 CORBA::Object_var object = ncRef->_set_policy_overrides(
37 policies, CORBA::SET_OVERRIDE );
39 policies[0]->destroy();
41 CosNaming::NamingContext_var namingContext =
42 CosNaming::NamingContext::_narrow( object.in());
43 namingContext->_non_existent();
45 catch ( const CORBA::TRANSIENT&)
47 ACE_DEBUG ((LM_DEBUG, "Caught transient\n"));
49 catch ( const CORBA::TIMEOUT&)
51 ACE_DEBUG ((LM_DEBUG, "Caught timeout\n"));
53 catch ( const CORBA::Exception& e )
55 e._tao_print_exception ("Exception caught");
58 return 0;