00001 // $Id: Leader_Follower_Flushing_Strategy.cpp 80620 2008-02-12 17:54:51Z johnc $ 00002 00003 #include "tao/Leader_Follower_Flushing_Strategy.h" 00004 #include "tao/LF_Follower.h" 00005 #include "tao/Leader_Follower.h" 00006 #include "tao/Transport.h" 00007 #include "tao/Queued_Message.h" 00008 #include "tao/ORB_Core.h" 00009 00010 ACE_RCSID (tao, 00011 Leader_Follower_Flushing_Strategy, 00012 "$Id: Leader_Follower_Flushing_Strategy.cpp 80620 2008-02-12 17:54:51Z johnc $") 00013 00014 00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00016 00017 int 00018 TAO_Leader_Follower_Flushing_Strategy::schedule_output (TAO_Transport *transport) 00019 { 00020 return transport->schedule_output_i (); 00021 } 00022 00023 int 00024 TAO_Leader_Follower_Flushing_Strategy::cancel_output ( 00025 TAO_Transport *transport) 00026 { 00027 return transport->cancel_output_i (); 00028 } 00029 00030 int 00031 TAO_Leader_Follower_Flushing_Strategy::flush_message ( 00032 TAO_Transport *transport, 00033 TAO_Queued_Message *msg, 00034 ACE_Time_Value *max_wait_time) 00035 { 00036 TAO_Leader_Follower &leader_follower = 00037 transport->orb_core ()->leader_follower (); 00038 return leader_follower.wait_for_event (msg, transport, max_wait_time); 00039 } 00040 00041 int 00042 TAO_Leader_Follower_Flushing_Strategy::flush_transport ( 00043 TAO_Transport *transport, 00044 ACE_Time_Value *max_wait_time) 00045 { 00046 try 00047 { 00048 TAO_ORB_Core * const orb_core = transport->orb_core (); 00049 00050 while (!transport->queue_is_empty ()) 00051 { 00052 if (orb_core->run (max_wait_time, 1) == -1) 00053 return -1; 00054 00055 if (max_wait_time != 0) { 00056 if (*max_wait_time <= ACE_Time_Value::zero) { 00057 errno = ETIME; 00058 return -1; 00059 } 00060 } 00061 } 00062 } 00063 catch (const ::CORBA::Exception&) 00064 { 00065 return -1; 00066 } 00067 00068 return 0; 00069 } 00070 00071 TAO_END_VERSIONED_NAMESPACE_DECL