00001 // -*- C++ -*- 00002 // $Id: Reactive_Flushing_Strategy.cpp 79065 2007-07-30 08:33:38Z johnnyw $ 00003 00004 #include "tao/Reactive_Flushing_Strategy.h" 00005 #include "tao/Transport.h" 00006 #include "tao/ORB_Core.h" 00007 #include "tao/Queued_Message.h" 00008 00009 ACE_RCSID (tao, 00010 Reactive_Flushing_Strategy, 00011 "$Id: Reactive_Flushing_Strategy.cpp 79065 2007-07-30 08:33:38Z johnnyw $") 00012 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 int 00017 TAO_Reactive_Flushing_Strategy::schedule_output (TAO_Transport *transport) 00018 { 00019 return transport->schedule_output_i (); 00020 } 00021 00022 int 00023 TAO_Reactive_Flushing_Strategy::cancel_output (TAO_Transport *transport) 00024 { 00025 return transport->cancel_output_i (); 00026 } 00027 00028 int 00029 TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport, 00030 TAO_Queued_Message *msg, 00031 ACE_Time_Value *max_wait_time) 00032 { 00033 int result = 0; 00034 00035 // @@ Should we pass this down? Can we? 00036 try 00037 { 00038 TAO_ORB_Core * const orb_core = transport->orb_core (); 00039 00040 while (!msg->all_data_sent () && result >= 0) 00041 { 00042 result = orb_core->run (max_wait_time, 1); 00043 } 00044 } 00045 catch (const ::CORBA::Exception&) 00046 { 00047 return -1; 00048 } 00049 00050 return result; 00051 } 00052 00053 int 00054 TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport) 00055 { 00056 // @@ Should we pass this down? Can we? 00057 try 00058 { 00059 TAO_ORB_Core * const orb_core = transport->orb_core (); 00060 00061 while (!transport->queue_is_empty ()) 00062 { 00063 if (orb_core->run (0, 1) == -1) 00064 return -1; 00065 } 00066 } 00067 catch (const ::CORBA::Exception&) 00068 { 00069 return -1; 00070 } 00071 00072 return 0; 00073 } 00074 00075 TAO_END_VERSIONED_NAMESPACE_DECL