Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Big_Oneways / Session_Control.cpp
blobdcf22af2c38f9e117f9fbc884fd162b14025a33e
1 #include "Session_Control.h"
3 Session_Control::Session_Control (CORBA::ULong session_count)
4 : session_count_ (session_count)
5 , success_ (1)
9 int
10 Session_Control::all_sessions_finished () const
12 return this->session_count_ == 0;
15 Session_Control::~Session_Control ()
17 if (this->session_count_ == 0 && this->success_)
19 ACE_DEBUG ((LM_DEBUG,
20 "(%P|%t) Session_Control::~Session_control, "
21 "good, all sessions did finish\n"));
23 else if (session_count_ != 0)
25 ACE_ERROR ((LM_ERROR,
26 "ERROR: (%P|%t) Session_Control::~Session_control, "
27 "%d sessions did not finish\n",
28 this->session_count_));
30 else
32 ACE_ERROR ((LM_ERROR,
33 "ERROR: (%P|%t) Session_Control::~Session_control, "
34 "some sessions failed\n"));
38 void
39 Session_Control::session_finished (CORBA::Boolean success)
41 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
42 if (this->session_count_ == 0)
44 ACE_ERROR ((LM_ERROR,
45 "ERROR: (%P|%t) Session_Control::session_finished, "
46 "unexpected callback\n"));
48 if (success == 0)
49 this->success_ = 0;
51 this->session_count_--;
52 ACE_DEBUG ((LM_DEBUG,
53 "(%P|%t) Session_Control::session_finished, "
54 "%d sessions to go\n",
55 this->session_count_));
56 if (session_count_ == 0)
58 PortableServer::POA_var poa =
59 this->_default_POA ();
60 PortableServer::ObjectId_var oid =
61 poa->servant_to_id (this);
62 poa->deactivate_object (oid.in ());