00001 // $Id: Leader_Follower_Flushing_Strategy.cpp 79065 2007-07-30 08:33:38Z johnnyw $ 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 79065 2007-07-30 08:33:38Z johnnyw $") 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 { 00028 return transport->cancel_output_i (); 00029 } 00030 00031 int 00032 TAO_Leader_Follower_Flushing_Strategy::flush_message ( 00033 TAO_Transport *transport, 00034 TAO_Queued_Message *msg, 00035 ACE_Time_Value *max_wait_time 00036 ) 00037 { 00038 TAO_Leader_Follower &leader_follower = 00039 transport->orb_core ()->leader_follower (); 00040 return leader_follower.wait_for_event (msg, transport, max_wait_time); 00041 } 00042 00043 int 00044 TAO_Leader_Follower_Flushing_Strategy::flush_transport ( 00045 TAO_Transport *transport 00046 ) 00047 { 00048 // @todo This is not the right way to do this.... 00049 00050 try 00051 { 00052 TAO_ORB_Core * const orb_core = transport->orb_core (); 00053 00054 while (!transport->queue_is_empty ()) 00055 { 00056 if (orb_core->run (0, 1) == -1) 00057 return -1; 00058 } 00059 } 00060 catch (const ::CORBA::Exception&) 00061 { 00062 return -1; 00063 } 00064 00065 return 0; 00066 } 00067 00068 TAO_END_VERSIONED_NAMESPACE_DECL