2 //=============================================================================
6 * Implements the timeout CORBA Object and its reply handler.
8 * @author Michael Kircher <Michael.Kircher@mchp.siemens.de>
10 //=============================================================================
13 #include "timeout_i.h"
14 #include "ace/OS_NS_unistd.h"
16 Timeout_i::Timeout_i (CORBA::ORB_ptr orb
)
18 orb_
= CORBA::ORB::_duplicate (orb
);
21 Timeout_i::~Timeout_i ()
26 Timeout_i::sendTimeToWait (CORBA::Long msec
)
28 //ACE_DEBUG ((LM_DEBUG,
29 // "Timeout_i::sendTimeToWait: invoked with msec = %d\n\n",
34 // ACE_DEBUG ((LM_DEBUG,
35 // "Timeout_i::sendTimeToWait: sleeping\n\n"));
37 ACE_Time_Value
tv (0, msec
* 1000);
43 Timeout_i::shutdown (void)
46 //ACE_DEBUG ((LM_DEBUG,
47 // "Timeout_i::shutdown: shut down ORB\n\n"));
50 // Reply Handler implementation
52 TimeoutHandler_i::TimeoutHandler_i ()
54 , reply_excep_counter_ (0)
61 TimeoutHandler_i::~TimeoutHandler_i ()
66 TimeoutHandler_i::sendTimeToWait (void)
75 TimeoutHandler_i::sendTimeToWait_excep (::Messaging::ExceptionHolder
*excep_holder
)
81 excep_holder
->raise_exception ();
83 catch (const CORBA::TIMEOUT
& )
87 ++reply_excep_counter_
;
92 "Error: Unexpected exception"));
97 TimeoutHandler_i::reset_reply_counter ()
103 TimeoutHandler_i::reset_reply_excep_counter ()
105 reply_excep_counter_
= 0;
109 TimeoutHandler_i::reply_counter ()
111 return reply_counter_
;
115 TimeoutHandler_i::reply_excep_counter ()
117 return reply_excep_counter_
;
121 TimeoutHandler_i::start ()
128 TimeoutHandler_i::elapsed_time ()
130 timer_
.elapsed_time (elapsed_time_
);
131 return elapsed_time_
;