TAO_Wait_On_Reactor Class Reference

Wait on the Reactor. Happens in s Single Threaded client environment. More...

#include <Wait_On_Reactor.h>

Inheritance diagram for TAO_Wait_On_Reactor:

Inheritance graph
[legend]
Collaboration diagram for TAO_Wait_On_Reactor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Wait_On_Reactor (TAO_Transport *transport)
 Constructor.

virtual ~TAO_Wait_On_Reactor (void)
 Destructor.

virtual int wait (ACE_Time_Value *max_wait_time, TAO_Synch_Reply_Dispatcher &rd)
virtual int register_handler (void)
virtual bool non_blocking (void) const
virtual bool can_process_upcalls (void) const

Detailed Description

Wait on the Reactor. Happens in s Single Threaded client environment.

Definition at line 33 of file Wait_On_Reactor.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Wait_On_Reactor::TAO_Wait_On_Reactor TAO_Transport transport  ) 
 

Constructor.

Definition at line 17 of file Wait_On_Reactor.cpp.

00018   : TAO_Wait_Strategy (transport)
00019 {
00020 }

TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor void   )  [virtual]
 

Destructor.

Definition at line 22 of file Wait_On_Reactor.cpp.

00023 {
00024 }


Member Function Documentation

bool TAO_Wait_On_Reactor::can_process_upcalls void   )  const [virtual]
 

This flag is to check whether the thread can process upcalls while waiting for the reply. Some wait strategies, like Wait_On_LF_No_Upcall does not allow the client threads to process requests while waiting for the reply.

Implements TAO_Wait_Strategy.

Definition at line 116 of file Wait_On_Reactor.cpp.

00117 {
00118   return true;
00119 }

bool TAO_Wait_On_Reactor::non_blocking void   )  const [virtual]
 

Returns a value to indicate whether the transport needs to set the socket on which it is waiting to non-blocking mode or not.

Implements TAO_Wait_Strategy.

Definition at line 110 of file Wait_On_Reactor.cpp.

00111 {
00112   return true;
00113 }

int TAO_Wait_On_Reactor::register_handler void   )  [virtual]
 

Register the handler needs with the reactor provided that it makes sense for the strategy.

Implements TAO_Wait_Strategy.

Definition at line 99 of file Wait_On_Reactor.cpp.

References TAO_Transport::register_handler().

00100 {
00101   if (!this->is_registered_)
00102     {
00103       return this->transport_->register_handler ();
00104     }
00105 
00106   return 1;
00107 }

int TAO_Wait_On_Reactor::wait ACE_Time_Value max_wait_time,
TAO_Synch_Reply_Dispatcher rd
[virtual]
 

Base class virtual method. Wait till the reply_received flag is true or the time expires.

Implements TAO_Wait_Strategy.

Definition at line 27 of file Wait_On_Reactor.cpp.

References TAO_LF_Invocation_Event::error_detected(), ETIME, ACE_Reactor::handle_events(), TAO_LF_Event::keep_waiting(), TAO_Transport::orb_core(), TAO_ORB_Core::reactor(), and TAO_LF_Invocation_Event::successful().

00029 {
00030   // Start the count down timer to account for the time spent in this
00031   // method.
00032   ACE_Countdown_Time countdown (max_wait_time);
00033 
00034   // Reactor does not change inside the loop.
00035   ACE_Reactor* const reactor =
00036     this->transport_->orb_core ()->reactor ();
00037 
00038   // Do the event loop, till we fully receive a reply.
00039   int result = 0;
00040 
00041   while (1)
00042     {
00043       // Run the event loop.
00044       result = reactor->handle_events (max_wait_time);
00045 
00046       // If we got our reply, no need to run the event loop any
00047       // further.
00048       if (!rd.keep_waiting ())
00049         {
00050           break;
00051         }
00052 
00053       // Did we timeout? If so, stop running the loop.
00054       if (result == 0
00055           && max_wait_time != 0
00056           && *max_wait_time == ACE_Time_Value::zero)
00057         {
00058           break;
00059         }
00060 
00061       // Other errors? If so, stop running the loop.
00062       if (result == -1)
00063         {
00064           break;
00065         }
00066 
00067       // Otherwise, keep going...
00068     }
00069 
00070   if (result == -1 || rd.error_detected ())
00071     {
00072       return -1;
00073     }
00074 
00075   // Return an error if there was a problem receiving the reply.
00076   if (max_wait_time != 0)
00077     {
00078       if (rd.successful () && *max_wait_time == ACE_Time_Value::zero)
00079         {
00080           result = -1;
00081           errno = ETIME;
00082         }
00083     }
00084   else
00085     {
00086       result = 0;
00087 
00088       if (rd.error_detected ())
00089         {
00090           result = -1;
00091         }
00092     }
00093 
00094   return result;
00095 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:24:29 2006 for TAO by doxygen 1.3.6