1 #include "Notifier_Handler.h"
2 #include "tao/ORB_Core.h"
5 Notifier_Handler::close ()
7 if (this->notifier_
!= 0)
10 "closing down Notifier_Handler\n"));
11 CORBA::release (this->notifier_
);
16 this->orb_
->shutdown ();
21 Notifier_Handler::shutdown ()
23 ACE_ASSERT (this->shutdowncallback
!= 0);
25 this->shutdowncallback
->close ();
29 Notifier_Handler::run ()
32 "Running the Supplier...\n"));
39 Notifier_Handler::reactor()
41 // @@ Please see if there's a way to get to the Reactor without
42 // using the TAO_ORB_Core_instance().
43 return TAO_ORB_Core_instance ()->reactor ();
46 Event_Comm::Notifier
*
47 Notifier_Handler::notifier ()
49 return this->notifier_
;
53 Notifier_Handler::notifier (Event_Comm::Notifier
*notifier
)
55 if (this->notifier_
!= notifier
)
57 CORBA::release (this->notifier_
);
58 this->notifier_
= notifier
;
64 Notifier_Handler::init (int argc
,
66 ShutdownCallback
* _shutdowncallback
)
69 shutdowncallback
= _shutdowncallback
;
74 this->orb_
= CORBA::ORB_init (argc
, argv
);
76 CORBA::Object_var poa_object
=
77 this->orb_
->resolve_initial_references ("RootPOA");
79 PortableServer::POA_var poa
=
80 PortableServer::POA::_narrow (poa_object
.in ());
82 PortableServer::POAManager_var poa_manager
=
83 poa
->the_POAManager ();
85 poa_manager
->activate ();
87 // Initialization of the naming service.
88 if (this->naming_client_
.init (orb_
.in ()) != 0)
89 ACE_ERROR_RETURN ((LM_ERROR
,
90 "(%P|%t) Unable to initialize "
91 "the TAO_Naming_Client.\n"),
94 CosNaming::Name
notifier_ref_name (1);
95 notifier_ref_name
.length (1);
96 notifier_ref_name
[0].id
=
97 CORBA::string_dup (NOTIFIER_BIND_NAME
);
99 CORBA::Object_var notifier_obj
=
100 this->naming_client_
->resolve (notifier_ref_name
);
103 // The CORBA::Object_var object is downcast to Notifier_var
104 // using the <_narrow> method.
106 Event_Comm::Notifier::_narrow (notifier_obj
.in ());
108 catch (const CORBA::Exception
& ex
)
110 ex
._tao_print_exception ("Notifier_Handler::init\n");