TAO_Block_Flushing_Strategy Class Reference

Implement a flushing strategy that blocks on write to flush. More...

#include <Block_Flushing_Strategy.h>

Inheritance diagram for TAO_Block_Flushing_Strategy:
Inheritance graph
[legend]
Collaboration diagram for TAO_Block_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.

Private Member Functions

int call_handle_output (TAO_Transport *transport, const TAO::Transport::Drain_Constraints &dc)

Detailed Description

Implement a flushing strategy that blocks on write to flush.

Definition at line 38 of file Block_Flushing_Strategy.h.


Member Function Documentation

int TAO_Block_Flushing_Strategy::call_handle_output ( TAO_Transport transport,
const TAO::Transport::Drain_Constraints &  dc 
) [private]

Definition at line 26 of file Block_Flushing_Strategy.cpp.

00028 {
00029   switch (transport->handle_output (dc).dre_)
00030     {
00031     case TAO_Transport::DR_ERROR: return -1;
00032     case TAO_Transport::DR_QUEUE_EMPTY: // won't happen, fall-through anyway
00033     case TAO_Transport::DR_OK: return 0;
00034     case TAO_Transport::DR_WOULDBLOCK:
00035       {
00036         ACE_Countdown_Time counter (dc.timeout ());
00037         TAO_Connection_Handler &ch = *transport->connection_handler ();
00038         if (ch.handle_write_ready (dc.timeout ()) == -1)
00039           {
00040             return -1;
00041           }
00042         return 0;
00043       }
00044     }
00045   return 0;
00046 }

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

Cancel all scheduled output for the transport argument.

Implements TAO_Flushing_Strategy.

Definition at line 20 of file Block_Flushing_Strategy.cpp.

00021 {
00022   return 0;
00023 }

int TAO_Block_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 49 of file Block_Flushing_Strategy.cpp.

00052 {
00053   TAO::Transport::Drain_Constraints dc (max_wait_time, true);
00054   while (!msg->all_data_sent ())
00055     {
00056       if (this->call_handle_output (transport, dc) == -1)
00057         return -1;
00058     }
00059   return 0;
00060 }

int TAO_Block_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 63 of file Block_Flushing_Strategy.cpp.

00065 {
00066   TAO::Transport::Drain_Constraints dc (max_wait_time, true);
00067   while (!transport->queue_is_empty ())
00068     {
00069       if (this->call_handle_output (transport, dc) == -1)
00070         return -1;
00071     }
00072   return 0;
00073 }

int TAO_Block_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 14 of file Block_Flushing_Strategy.cpp.

00015 {
00016   return MUST_FLUSH;
00017 }


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:26:04 2009 for TAO by  doxygen 1.6.1