TAO_Acceptor Class Reference

Abstract Acceptor class used for pluggable transports. More...

#include <Transport_Acceptor.h>

Inheritance diagram for TAO_Acceptor:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TAO_Acceptor (CORBA::ULong tag)
virtual ~TAO_Acceptor (void)
 Destructor.
CORBA::ULong tag (void) const
 The tag, each concrete class will have a specific tag value.
void set_error_retry_delay (time_t delay)
virtual int open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, int version_major, int version_minor, const char *address, const char *options=0)=0
 Method to initialize acceptor for address.
virtual int open_default (TAO_ORB_Core *, ACE_Reactor *reactor, int version_major, int version_minor, const char *options=0)=0
virtual int close (void)=0
 Closes the acceptor.
virtual int create_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, CORBA::Short priority)=0
virtual int is_collocated (const TAO_Endpoint *endpoint)=0
 Return 1 if the endpoint has the same address as the acceptor.
virtual CORBA::ULong endpoint_count (void)=0
virtual int object_key (IOP::TaggedProfile &profile, TAO::ObjectKey &key)=0
int handle_accept_error (ACE_Event_Handler *base_acceptor)
int handle_expiration (ACE_Event_Handler *base_acceptor)

Private Attributes

CORBA::ULong const tag_
 IOP protocol tag.
time_t error_retry_delay_

Detailed Description

Abstract Acceptor class used for pluggable transports.

Base class for the Acceptor bridge class.

Todo:
Need to rename the class as TAO_Transport_Acceptor.

Definition at line 77 of file Transport_Acceptor.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Acceptor::TAO_Acceptor ( CORBA::ULong  tag  ) 

Definition at line 18 of file Transport_Acceptor.cpp.

00019   : tag_ (tag),
00020     error_retry_delay_ (5)
00021 {
00022 }

TAO_Acceptor::~TAO_Acceptor ( void   )  [virtual]

Destructor.

Definition at line 24 of file Transport_Acceptor.cpp.

00025 {
00026 
00027   //@@ TAO_ACCEPTOR_DESTRUCTOR_ADD_HOOK
00028 }


Member Function Documentation

virtual int TAO_Acceptor::close ( void   )  [pure virtual]

Closes the acceptor.

Implemented in TAO_IIOP_Acceptor.

virtual int TAO_Acceptor::create_profile ( const TAO::ObjectKey &  object_key,
TAO_MProfile mprofile,
CORBA::Short  priority 
) [pure virtual]

Create the corresponding profile for this endpoint. If share_profile is set to true, the pluggable protocol implementation should try to add the endpoint to a profile in the mprofile that is of the same type. Currently, this is used when RT CORBA is enabled.

Implemented in TAO_IIOP_Acceptor.

virtual CORBA::ULong TAO_Acceptor::endpoint_count ( void   )  [pure virtual]

Returns the number of endpoints this acceptor is listening on. This is used for determining how many profiles will be generated for this acceptor.

Implemented in TAO_IIOP_Acceptor.

int TAO_Acceptor::handle_accept_error ( ACE_Event_Handler base_acceptor  ) 

This method is not directly associated with the method of the same name on the ACE_Acceptor template class. However, it is called by the TAO_Strategy_Acceptor method of the same name.

Definition at line 31 of file Transport_Acceptor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_DEBUG, ACE_Event_Handler::DONT_CALL, ENFILE, ACE_Event_Handler::EXCEPT_MASK, LM_DEBUG, ACE_Event_Handler::reactor(), ACE_Reactor::register_handler(), ACE_Reactor::remove_handler(), ACE_Reactor::schedule_timer(), and TAO_debug_level.

Referenced by TAO_Strategy_Acceptor< SVC_HANDLER, >::handle_accept_error().

00032 {
00033   if (errno == EMFILE || errno == ENFILE)
00034     {
00035       if (TAO_debug_level > 0)
00036         ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - "
00037                               "TAO_Acceptor::handle_accept_error - "
00038                               "Too many files open\n"));
00039 
00040       // If the user has decided to stop accepting when the file handles
00041       // run out, just return -1;
00042       if (this->error_retry_delay_ == 0)
00043         return -1;
00044 
00045       // Get the reactor.  If there isn't one, which isn't very likely,
00046       // then just return -1.
00047       ACE_Reactor* reactor = base_acceptor->reactor ();
00048       if (reactor == 0)
00049         return -1;
00050 
00051       // So that the reactor doesn't completely remove this handler from
00052       // the reactor, register it with the except mask.  It should be
00053       // removed in the timer handler.
00054       reactor->register_handler (base_acceptor,
00055                                  ACE_Event_Handler::EXCEPT_MASK);
00056 
00057       // Remove the handler so that the reactor doesn't attempt to
00058       // process this handle again (and tightly spin).
00059       reactor->remove_handler (base_acceptor,
00060                                ACE_Event_Handler::ACCEPT_MASK |
00061                                ACE_Event_Handler::DONT_CALL);
00062 
00063       // Schedule a timer so that we can resume the handler in hopes
00064       // that some file handles have freed up.
00065       ACE_Time_Value timeout (this->error_retry_delay_);
00066       reactor->schedule_timer (base_acceptor, 0, timeout);
00067     }
00068 
00069   // We want to keep accepting in all other situations.
00070   return 0;
00071 }

int TAO_Acceptor::handle_expiration ( ACE_Event_Handler base_acceptor  ) 

Perform the handle_timeout functionality to put this acceptor back into the reactor to try accepting again.

Definition at line 74 of file Transport_Acceptor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_DEBUG, ACE_Event_Handler::DONT_CALL, ACE_Event_Handler::EXCEPT_MASK, LM_DEBUG, ACE_Event_Handler::reactor(), ACE_Reactor::register_handler(), ACE_Reactor::remove_handler(), and TAO_debug_level.

Referenced by TAO_Strategy_Acceptor< SVC_HANDLER, >::handle_timeout().

00075 {
00076   // Get the reactor.  If there isn't one, which isn't very likely, then
00077   // just return -1;
00078   ACE_Reactor* reactor = base_acceptor->reactor ();
00079   if (reactor == 0)
00080     return -1;
00081 
00082   if (TAO_debug_level > 0)
00083     ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - "
00084                           "TAO_Acceptor::handle_expiration - "
00085                           "Re-registering the acceptor\n"));
00086 
00087   // Try again to allow incoming connections
00088   reactor->register_handler (base_acceptor, ACE_Event_Handler::ACCEPT_MASK);
00089 
00090   // Remove the except mask that was added during the handling of the
00091   // accept() error.  That is the only reason that we're in this method
00092   // in the first place.
00093   reactor->remove_handler (base_acceptor, ACE_Event_Handler::EXCEPT_MASK |
00094                                           ACE_Event_Handler::DONT_CALL);
00095   return 0;
00096 }

virtual int TAO_Acceptor::is_collocated ( const TAO_Endpoint endpoint  )  [pure virtual]

Return 1 if the endpoint has the same address as the acceptor.

Implemented in TAO_IIOP_Acceptor.

virtual int TAO_Acceptor::object_key ( IOP::TaggedProfile &  profile,
TAO::ObjectKey &  key 
) [pure virtual]

This method fetches the key from the profile. Protocols that are pluggable can send data that are specific in the profile_data field encapsulated as a octet stream. This method allows those protocols to get the object key from the encapsulation.

Implemented in TAO_IIOP_Acceptor.

Referenced by TAO_Tagged_Profile::extract_object_key().

virtual int TAO_Acceptor::open ( TAO_ORB_Core orb_core,
ACE_Reactor reactor,
int  version_major,
int  version_minor,
const char *  address,
const char *  options = 0 
) [pure virtual]

Method to initialize acceptor for address.

Implemented in TAO_IIOP_Acceptor.

Referenced by TAO_Acceptor_Registry::open_i().

virtual int TAO_Acceptor::open_default ( TAO_ORB_Core ,
ACE_Reactor reactor,
int  version_major,
int  version_minor,
const char *  options = 0 
) [pure virtual]

Open an acceptor with the given protocol version on a default endpoint

Implemented in TAO_IIOP_Acceptor.

Referenced by TAO_Acceptor_Registry::open_default_i().

ACE_INLINE void TAO_Acceptor::set_error_retry_delay ( time_t  delay  ) 

Set the amount of time to delay accepting new connections in the event that we encounter an error that may be transient.

Definition at line 14 of file Transport_Acceptor.inl.

References error_retry_delay_.

Referenced by TAO_IIOP_Acceptor::open_i().

00015 {
00016   this->error_retry_delay_ = delay;
00017 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::ULong TAO_Acceptor::tag ( void   )  const

The tag, each concrete class will have a specific tag value.

Definition at line 8 of file Transport_Acceptor.inl.

References tag_.

00009 {
00010   return this->tag_;
00011 }


Member Data Documentation

time_t TAO_Acceptor::error_retry_delay_ [private]

Definition at line 163 of file Transport_Acceptor.h.

Referenced by set_error_retry_delay().

CORBA::ULong const TAO_Acceptor::tag_ [private]

IOP protocol tag.

Definition at line 161 of file Transport_Acceptor.h.

Referenced by tag().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:21 2010 for TAO by  doxygen 1.4.7