blob: 8eb96ccb63574417dac67fb5f4e665378694dbdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/**
* @file ORB_Task.cpp
*
* @author Carlos O'Ryan <coryan@atdesk.com>
*/
#include "ORB_Task.h"
#include "tao/Messaging/Messaging.h"
#include "orbsvcs/CosNamingC.h"
ORB_Task::ORB_Task (CORBA::ORB_ptr orb)
: orb_ (CORBA::ORB::_duplicate (orb))
{
}
int
ORB_Task::svc ()
{
try
{
CORBA::Object_var ncRef =
orb_->string_to_object(
"corbaloc:iiop:10.175.12.99:15025/NameService" );
CORBA::PolicyList policies;
TimeBase::TimeT timeout = 5000 * 10000;
CORBA::Any timeoutAny;
timeoutAny <<= timeout;
policies.length(1);
policies[0] = orb_->create_policy(
Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
timeoutAny );
CORBA::Object_var object = ncRef->_set_policy_overrides(
policies, CORBA::SET_OVERRIDE );
policies[0]->destroy();
CosNaming::NamingContext_var namingContext =
CosNaming::NamingContext::_narrow( object.in() );
namingContext->_non_existent();
}
catch ( const CORBA::TRANSIENT&)
{
ACE_DEBUG ((LM_DEBUG, "Caught transient\n"));
}
catch ( const CORBA::TIMEOUT&)
{
ACE_DEBUG ((LM_DEBUG, "Caught timeout\n"));
}
catch ( const CORBA::Exception& e )
{
e._tao_print_exception ("Exception caught");
}
return 0;
}
|