Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Big_Oneways / Peer.cpp
blobd81779cec2d0bc93282bf89b9d1f140c23394dcb
1 #include "Peer.h"
2 #include "Session.h"
4 Peer::Peer (CORBA::ORB_ptr orb)
5 : orb_ (CORBA::ORB::_duplicate (orb))
9 Peer::~Peer ()
13 Test::Session_ptr
14 Peer::create_session (Test::Session_Control_ptr control,
15 CORBA::ULong payload_size,
16 CORBA::ULong thread_count,
17 CORBA::ULong message_count,
18 CORBA::ULong peer_count)
20 Session *session_impl = 0;
21 ACE_NEW_THROW_EX (session_impl,
22 Session (control,
23 payload_size,
24 thread_count,
25 message_count,
26 peer_count),
27 CORBA::NO_MEMORY ());
28 PortableServer::ServantBase_var transfer_ownership (session_impl);
29 Test::Session_var session;
31 #if defined (CORBA_E_COMPACT) || defined (CORBA_E_MICRO)
32 PortableServer::POA_var poa = this->_default_POA ();
33 PortableServer::ObjectId_var id = poa->activate_object (transfer_ownership.in ());
34 CORBA::Object_var object = poa->id_to_reference (id.in ());
35 session = Test::Session::_unchecked_narrow (object.in());
36 #else
37 session = session_impl->_this ();
38 #endif /* CORBA_E_COMPACT || CORBA_E_MICRO */
40 return session._retn ();
43 void
44 Peer::shutdown ()
46 ACE_DEBUG ((LM_DEBUG,
47 "(%P|%t) Peer::shutdown, waiting for threads\n"));
49 ACE_DEBUG ((LM_DEBUG,
50 "(%P|%t) Peer::shutdown, shutting down ORB\n"));
51 this->orb_->shutdown (false);