2 #include "tao/Messaging/Asynch_Timeout_Handler.h"
4 #include "tao/Messaging/Asynch_Reply_Dispatcher.h"
5 #include "tao/Transport_Mux_Strategy.h"
6 #include "ace/Reactor.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 TAO_Asynch_Timeout_Handler::TAO_Asynch_Timeout_Handler (
16 // Enable reference counting on the event handler.
17 this->reference_counting_policy ().value (
18 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
);
22 TAO_Asynch_Timeout_Handler::schedule_timer (TAO_Transport_Mux_Strategy
*tms
,
23 CORBA::ULong request_id
,
24 const ACE_Time_Value
&max_wait_time
)
26 // Remember them for later.
28 this->request_id_
= request_id
;
30 return this->reactor_
->schedule_timer (this, // handler
36 TAO_Asynch_Timeout_Handler::handle_timeout (const ACE_Time_Value
&,
39 // Check if there was a reply dispatcher registered in the tms, if not
40 // the reply already got dispatched by another thread
41 if (this->tms_
->reply_timed_out (this->request_id_
) == 0)
43 if (TAO_debug_level
>= 4)
45 TAOLIB_DEBUG ((LM_DEBUG
,
46 ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Timeout_Handler")
47 ACE_TEXT ("::handle_timeout, request [%d] timed out\n"),
53 if (TAO_debug_level
>= 1)
55 TAOLIB_ERROR ((LM_ERROR
,
56 ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Timeout_Handler")
57 ACE_TEXT ("::handle_timeout, unable to dispatch timed out request [%d]\n"),
62 // reset any possible timeout errno
65 // we are unregistered anyway
70 TAO_Asynch_Timeout_Handler::cancel ()
72 // The tms_ is only set if we got scheduled.
75 this->reactor_
->cancel_timer (this);
79 TAO_END_VERSIONED_NAMESPACE_DECL