Public Member Functions

TAO_Wait_On_Read Class Reference

#include <Wait_On_Read.h>

Inheritance diagram for TAO_Wait_On_Read:
Inheritance graph
[legend]
Collaboration diagram for TAO_Wait_On_Read:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_Wait_On_Read (TAO_Transport *transport)
 Constructor.
virtual ~TAO_Wait_On_Read (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

Simply block on read() to wait for the reply.

Definition at line 32 of file Wait_On_Read.h.


Constructor & Destructor Documentation

TAO_Wait_On_Read::TAO_Wait_On_Read ( TAO_Transport transport  ) 

Constructor.

Definition at line 19 of file Wait_On_Read.cpp.

  : TAO_Wait_Strategy (transport)
{
}

TAO_Wait_On_Read::~TAO_Wait_On_Read ( void   )  [virtual]

Destructor.

Definition at line 25 of file Wait_On_Read.cpp.

{
}


Member Function Documentation

bool TAO_Wait_On_Read::can_process_upcalls ( void   )  const [virtual]

Flag that indicates whether we can process requests while waiting for the reply. 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 132 of file Wait_On_Read.cpp.

{
  return true;
}

bool TAO_Wait_On_Read::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 126 of file Wait_On_Read.cpp.

{
  return false;
}

int TAO_Wait_On_Read::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 120 of file Wait_On_Read.cpp.

{
  return 0;
}

int TAO_Wait_On_Read::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 39 of file Wait_On_Read.cpp.

{
  // Start the count down timer to account for the time spent in this
  // method.
  ACE_Countdown_Time countdown (max_wait_time);

  rd.state_changed (TAO_LF_Event::LFS_ACTIVE,
                    this->transport_->orb_core ()->leader_follower ());

  // Do the same sort of looping that is done in other wait
  // strategies.
  int retval = 0;
  TAO_Resume_Handle rh;
  while (1)
    {
      retval = this->transport_->handle_input (rh, max_wait_time);

      // If we got our reply, no need to run the loop any
      // further.
      if (!rd.keep_waiting ())
        break;

      // @@ We are not checking for timeouts here...

      // If we got an error just break
      if (retval == -1)
        break;
    }

  if (rd.error_detected () == -1 || retval == -1)
    {
      this->transport_->close_connection ();
    }

  if (rd.successful ())
     {
       TAO_ORB_Core * const oc =
         this->transport_->orb_core ();

       if (!oc->client_factory ()->use_cleanup_options ())
         return 0;

       if (TAO_debug_level > 0)
         ACE_DEBUG ((LM_DEBUG,
                     ACE_TEXT ("TAO (%P|%t) - TAO_Wait_On_Read[%d]::wait (), ")
                     ACE_TEXT ("registering handle for cleanup\n"),
                     this->transport_->id ()));

       ACE_Event_Handler * const eh =
         this->transport_->event_handler_i ();

       ACE_Reactor * const r =
         this->transport_->orb_core ()->reactor ();

       if (r->register_handler (eh,
                                ACE_Event_Handler::READ_MASK) == -1)
         {
           if (TAO_debug_level > 0)
             ACE_ERROR ((LM_ERROR,
                         ACE_TEXT ("TAO (%P|%t) - TAO_Wait_On_Read[%d]::wait (), ")
                        ACE_TEXT ("registration with reactor returned an error\n"),
                         this->transport_->id ()));
        }
       else
        {
          // Only set this flag when registration succeeds
          this->is_registered_ = true;
        }

       return 0;
     }

  if (rd.error_detected ())
    return -1;

  return 1;
}


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