Implement a flushing strategy that uses the Leader/Follower set. More...
#include <Leader_Follower_Flushing_Strategy.h>
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. |
Implement a flushing strategy that uses the Leader/Follower set.
Definition at line 32 of file Leader_Follower_Flushing_Strategy.h.
int TAO_Leader_Follower_Flushing_Strategy::cancel_output | ( | TAO_Transport * | transport | ) | [virtual] |
Cancel all scheduled output for the transport argument.
Implements TAO_Flushing_Strategy.
Definition at line 24 of file Leader_Follower_Flushing_Strategy.cpp.
{ return transport->cancel_output_i (); }
int TAO_Leader_Follower_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 31 of file Leader_Follower_Flushing_Strategy.cpp.
{ TAO_Leader_Follower &leader_follower = transport->orb_core ()->leader_follower (); return leader_follower.wait_for_event (msg, transport, max_wait_time); }
int TAO_Leader_Follower_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 42 of file Leader_Follower_Flushing_Strategy.cpp.
{ try { TAO_ORB_Core * const orb_core = transport->orb_core (); while (!transport->queue_is_empty ()) { // In case max_wait_time==0 we cannot simply run the orb because // in multi-threaded applications it can easily happen that // the other thread will run the orb and drain the queue in the // transport we're coping with here and this thread will block. // Instead we do run for a small amount of time and then recheck // the queue. if (max_wait_time == 0) { ACE_Errno_Guard eguard (errno); // Poll the reactor's queue. ACE_Time_Value tv = ACE_Time_Value::zero; orb_core->orb ()->perform_work (&tv); } else { orb_core->orb ()->perform_work (max_wait_time); } if (max_wait_time != 0) { if (*max_wait_time <= ACE_Time_Value::zero) { errno = ETIME; return -1; } } } } catch (const ::CORBA::Exception&) { return -1; } return 0; }
int TAO_Leader_Follower_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 18 of file Leader_Follower_Flushing_Strategy.cpp.
{ return transport->schedule_output_i (); }