00001 // Leader_Follower_Flushing_Strategy.cpp,v 1.7 2005/11/02 07:13:03 ossama Exp 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 "Leader_Follower_Flushing_Strategy.cpp,v 1.7 2005/11/02 07:13:03 ossama Exp") 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 ACE_DECLARE_NEW_CORBA_ENV; 00051 ACE_TRY 00052 { 00053 TAO_ORB_Core *orb_core = transport->orb_core (); 00054 00055 while (!transport->queue_is_empty ()) 00056 { 00057 int result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER); 00058 ACE_TRY_CHECK; 00059 00060 if (result == -1) 00061 return -1; 00062 } 00063 } 00064 ACE_CATCHANY 00065 { 00066 return -1; 00067 } 00068 ACE_ENDTRY; 00069 00070 return 0; 00071 } 00072 00073 TAO_END_VERSIONED_NAMESPACE_DECL