Reactive_Flushing_Strategy.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // Reactive_Flushing_Strategy.cpp,v 1.10 2006/04/19 09:05:50 jwillemsen Exp
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            "Reactive_Flushing_Strategy.cpp,v 1.10 2006/04/19 09:05:50 jwillemsen Exp")
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   ACE_DECLARE_NEW_CORBA_ENV;
00037   ACE_TRY
00038     {
00039       TAO_ORB_Core * const orb_core = transport->orb_core ();
00040 
00041       while (!msg->all_data_sent () && result >= 0)
00042         {
00043           result = orb_core->run (max_wait_time, 1 ACE_ENV_ARG_PARAMETER);
00044           ACE_TRY_CHECK;
00045         }
00046     }
00047   ACE_CATCHANY
00048     {
00049       return -1;
00050     }
00051   ACE_ENDTRY;
00052 
00053   return result;
00054 }
00055 
00056 int
00057 TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport)
00058 {
00059   // @@ Should we pass this down?  Can we?
00060   ACE_DECLARE_NEW_CORBA_ENV;
00061   ACE_TRY
00062     {
00063       TAO_ORB_Core * const orb_core = transport->orb_core ();
00064 
00065       while (!transport->queue_is_empty ())
00066         {
00067           int const result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER);
00068           ACE_TRY_CHECK;
00069 
00070           if (result == -1)
00071             return -1;
00072         }
00073     }
00074   ACE_CATCHANY
00075     {
00076       return -1;
00077     }
00078   ACE_ENDTRY;
00079 
00080   return 0;
00081 }
00082 
00083 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 11:54:21 2006 for TAO by doxygen 1.3.6