TAO_Reactive_Flushing_Strategy Class Reference

Implement a flushing strategy that uses the reactor. More...

#include <Reactive_Flushing_Strategy.h>

Inheritance diagram for TAO_Reactive_Flushing_Strategy:

Inheritance graph
[legend]
Collaboration diagram for TAO_Reactive_Flushing_Strategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual int schedule_output (TAO_Transport *transport)
virtual int cancel_output (TAO_Transport *transport)
 Cancel all scheduled output for the transport argument.
virtual int flush_message (TAO_Transport *transport, TAO_Queued_Message *msg, ACE_Time_Value *max_wait_time)
virtual int flush_transport (TAO_Transport *transport, ACE_Time_Value *max_wait_time)
 Wait until the transport has no messages queued.

Detailed Description

Implement a flushing strategy that uses the reactor.

Definition at line 31 of file Reactive_Flushing_Strategy.h.


Member Function Documentation

int TAO_Reactive_Flushing_Strategy::cancel_output ( TAO_Transport transport  )  [virtual]

Cancel all scheduled output for the transport argument.

Implements TAO_Flushing_Strategy.

Definition at line 23 of file Reactive_Flushing_Strategy.cpp.

References TAO_Transport::cancel_output_i().

00024 {
00025   return transport->cancel_output_i ();
00026 }

int TAO_Reactive_Flushing_Strategy::flush_message ( TAO_Transport transport,
TAO_Queued_Message msg,
ACE_Time_Value max_wait_time 
) [virtual]

Wait until msg is sent out. Potentially other messages are flushed too, for example, because there are ahead in the queue.

Implements TAO_Flushing_Strategy.

Definition at line 29 of file Reactive_Flushing_Strategy.cpp.

References TAO_Queued_Message::all_data_sent(), TAO_Transport::orb_core(), TAO_ORB_Core::run(), and ACE_Time_Value::zero.

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           if (max_wait_time != 0) {
00045             if (*max_wait_time <= ACE_Time_Value::zero) {
00046               errno = ETIME;
00047               result = -1;
00048             }
00049           }
00050         }
00051     }
00052   catch (const ::CORBA::Exception&)
00053     {
00054       return -1;
00055     }
00056 
00057   return result;
00058 }

int TAO_Reactive_Flushing_Strategy::flush_transport ( TAO_Transport transport,
ACE_Time_Value max_wait_time 
) [virtual]

Wait until the transport has no messages queued.

Implements TAO_Flushing_Strategy.

Definition at line 61 of file Reactive_Flushing_Strategy.cpp.

References TAO_Transport::orb_core(), TAO_Transport::queue_is_empty(), TAO_ORB_Core::run(), and ACE_Time_Value::zero.

00063 {
00064   try
00065     {
00066       TAO_ORB_Core * const orb_core = transport->orb_core ();
00067 
00068       while (!transport->queue_is_empty ())
00069         {
00070           if (orb_core->run (max_wait_time, 1) == -1)
00071             return -1;
00072 
00073           if (max_wait_time != 0) {
00074             if (*max_wait_time <= ACE_Time_Value::zero) {
00075               errno = ETIME;
00076               return -1;
00077             }
00078           }
00079         }
00080     }
00081   catch (const ::CORBA::Exception&)
00082     {
00083       return -1;
00084     }
00085 
00086   return 0;
00087 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL int TAO_Reactive_Flushing_Strategy::schedule_output ( TAO_Transport transport  )  [virtual]

Schedule the transport argument to be flushed If -2 is returned then the caller must call one of the flush_* methods. If -1 is returned then there was an error. If 0 is returned then the flush was scheduled successfully.

Implements TAO_Flushing_Strategy.

Definition at line 17 of file Reactive_Flushing_Strategy.cpp.

00018 {
00019   return transport->schedule_output_i ();
00020 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:44 2010 for TAO by  doxygen 1.4.7