Go to the documentation of this file.00001
00002
00003
00004 #include "tao/Messaging/Asynch_Timeout_Handler.h"
00005
00006 #include "tao/Messaging/Asynch_Reply_Dispatcher.h"
00007 #include "tao/Transport_Mux_Strategy.h"
00008 #include "ace/Reactor.h"
00009
00010 ACE_RCSID (Messaging,
00011 Asynch_Timeout_Handler,
00012 "$Id: Asynch_Timeout_Handler.cpp 82605 2008-08-12 16:31:20Z johnnyw $")
00013
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015
00016 TAO_Asynch_Timeout_Handler::TAO_Asynch_Timeout_Handler (
00017 ACE_Reactor *reactor)
00018 : tms_ (0),
00019 request_id_ (0),
00020 reactor_ (reactor)
00021 {
00022
00023 this->reference_counting_policy ().value (
00024 ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
00025 }
00026
00027 TAO_Asynch_Timeout_Handler::~TAO_Asynch_Timeout_Handler ()
00028 {
00029 }
00030
00031
00032 long
00033 TAO_Asynch_Timeout_Handler::schedule_timer (TAO_Transport_Mux_Strategy *tms,
00034 CORBA::ULong request_id,
00035 const ACE_Time_Value &max_wait_time)
00036 {
00037
00038 this->tms_ = tms;
00039 this->request_id_ = request_id;
00040
00041 return this->reactor_->schedule_timer (this,
00042 0,
00043 max_wait_time);
00044 }
00045
00046 int
00047 TAO_Asynch_Timeout_Handler::handle_timeout (const ACE_Time_Value &,
00048 const void *)
00049 {
00050
00051
00052 if (this->tms_->reply_timed_out (this->request_id_) == 0)
00053 {
00054 if (TAO_debug_level >= 4)
00055 {
00056 ACE_DEBUG ((LM_DEBUG,
00057 ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Timeout_Handler")
00058 ACE_TEXT ("::handle_timeout, request %d timed out\n"),
00059 this->request_id_));
00060 }
00061 }
00062 else
00063 {
00064 if (TAO_debug_level >= 1)
00065 {
00066 ACE_ERROR ((LM_ERROR,
00067 ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Timeout_Handler")
00068 ACE_TEXT ("::handle_timeout, unable to dispatch timed out request %d\n"),
00069 this->request_id_));
00070 }
00071 }
00072
00073
00074 errno = 0;
00075
00076
00077 return 0;
00078 }
00079
00080 void
00081 TAO_Asynch_Timeout_Handler::cancel ()
00082 {
00083
00084 if (this->tms_)
00085 {
00086 this->reactor_->cancel_timer (this);
00087 }
00088 }
00089
00090 TAO_END_VERSIONED_NAMESPACE_DECL