Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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 Methods

 TAO_Wait_On_Reactor (TAO_Transport *transport)
 Constructor. More...

virtual ~TAO_Wait_On_Reactor (void)
 Destructor. More...

virtual int wait (ACE_Time_Value *max_wait_time, TAO_Synch_Reply_Dispatcher &rd)
 Base class virtual method. Wait till the <reply_received> flag is true or the time expires. More...

virtual int register_handler (void)
 Register the handler needs with the reactor provided that it makes sense for the strategy. More...

virtual int non_blocking (void)
 Returns a value to indicate whether the transport needs to set the socket on which it is waiting to non-blocking mode or not. More...


Detailed Description

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

Definition at line 31 of file Wait_On_Reactor.h.


Constructor & Destructor Documentation

TAO_Wait_On_Reactor::TAO_Wait_On_Reactor TAO_Transport   transport
 

Constructor.

Definition at line 12 of file Wait_On_Reactor.cpp.

00013   : TAO_Wait_Strategy (transport)
00014 {
00015 }

TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor void    [virtual]
 

Destructor.

Definition at line 17 of file Wait_On_Reactor.cpp.

00018 {
00019 }


Member Function Documentation

int TAO_Wait_On_Reactor::non_blocking void    [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 92 of file Wait_On_Reactor.cpp.

00093 {
00094   return 1;
00095 }

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 83 of file Wait_On_Reactor.cpp.

References TAO_Wait_Strategy::is_registered_, TAO_Transport::register_handler, and TAO_Wait_Strategy::transport_.

00084 {
00085   if (this->is_registered_ == 0)
00086      return this->transport_->register_handler ();
00087 
00088   return 1;
00089 }

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 22 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, TAO_LF_Invocation_Event::successful, TAO_Wait_Strategy::transport_, and ACE_Time_Value::zero.

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


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:47:03 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002