TAO_OC_Endpoint_Selector_Factory Class Reference

Factory for initializing <Endpoint_Selection_State> and obtaining appropriate <Invocation_Endpoint_Selector>. More...

#include <OC_Endpoint_Selector_Factory.h>

Inheritance diagram for TAO_OC_Endpoint_Selector_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_OC_Endpoint_Selector_Factory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_OC_Endpoint_Selector_Factory (void)
 Constructor.
virtual ~TAO_OC_Endpoint_Selector_Factory (void)
 Destructor.
virtual int init (int argc, ACE_TCHAR *argv[])
virtual TAO_Invocation_Endpoint_Selectorget_selector (void)

Protected Member Functions

int register_orb_initializer (void)

Protected Attributes

TAO_Optimized_Connection_Endpoint_Selectoroc_endpoint_selector_

Detailed Description

Factory for initializing <Endpoint_Selection_State> and obtaining appropriate <Invocation_Endpoint_Selector>.

Used by Invocation classes to initialize its endpoint selection strategy and state based on the effective policies. Endpoint selection strategies are stateless objects - all the state they need is contained by Invocation in <Endpoint_Selection_State>. Thus, rather than allocating an endpoint selection strategy object for each Invocation, the factory simply returns the appropriate one from the set preallocated in the ORB_Core. One endpoint selection strategy object can be used by many invocations concurrently.

Definition at line 54 of file OC_Endpoint_Selector_Factory.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_OC_Endpoint_Selector_Factory::TAO_OC_Endpoint_Selector_Factory ( void   ) 

Constructor.

Definition at line 18 of file OC_Endpoint_Selector_Factory.cpp.

00019   : oc_endpoint_selector_(0)
00020 {
00021 }

TAO_OC_Endpoint_Selector_Factory::~TAO_OC_Endpoint_Selector_Factory ( void   )  [virtual]

Destructor.

Definition at line 23 of file OC_Endpoint_Selector_Factory.cpp.

References oc_endpoint_selector_.

00024 {
00025   delete this->oc_endpoint_selector_;
00026 }


Member Function Documentation

TAO_Invocation_Endpoint_Selector * TAO_OC_Endpoint_Selector_Factory::get_selector ( void   )  [virtual]

Get an Invocation's endpoint selection strategy and initialize the endpoint selection state instance.

Implements TAO_Endpoint_Selector_Factory.

Definition at line 89 of file OC_Endpoint_Selector_Factory.cpp.

References oc_endpoint_selector_.

00090 {
00091   // Trivial endpoint selector.  Just return the default selector.
00092   return this->oc_endpoint_selector_;
00093 }

int TAO_OC_Endpoint_Selector_Factory::init ( int  argc,
ACE_TCHAR argv[] 
) [virtual]

Reimplemented from ACE_Shared_Object.

Definition at line 29 of file OC_Endpoint_Selector_Factory.cpp.

References ACE_NEW_RETURN, ACE_TEXT, ACE_Time_Value::msec(), ACE_OS::strcasecmp(), and ACE_OS::strtol().

00030 {
00031   ACE_Time_Value timeout(0,0);
00032 
00033   for (int count = 0; count < argc; count++)
00034     {
00035       if ((ACE_OS::strcasecmp (argv[count],
00036                                ACE_TEXT ("-connect_timeout")) == 0) &&
00037           count < argc-1)
00038         {
00039           ++count;
00040           long const ms = ACE_OS::strtol(argv[count],0,10);
00041           timeout.msec (ms);
00042         }
00043     }
00044 
00045   if (this->register_orb_initializer () == -1)
00046     return -1;
00047 
00048   ACE_NEW_RETURN (this->oc_endpoint_selector_,
00049                   TAO_Optimized_Connection_Endpoint_Selector(timeout),
00050                   -1);
00051   return 0;
00052 }

int TAO_OC_Endpoint_Selector_Factory::register_orb_initializer ( void   )  [protected]

Definition at line 55 of file OC_Endpoint_Selector_Factory.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, PortableInterceptor::register_orb_initializer(), and TAO::VMCID.

00056 {
00057   // Register the ORB initializer.
00058   try
00059     {
00060       PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
00061         PortableInterceptor::ORBInitializer::_nil ();
00062 
00063       /// Register the RTCORBA ORBInitializer.
00064       ACE_NEW_THROW_EX (temp_orb_initializer,
00065                         TAO_Strategies_ORBInitializer,
00066                         CORBA::NO_MEMORY (
00067                           CORBA::SystemException::_tao_minor_code (
00068                             TAO::VMCID,
00069                             ENOMEM),
00070                           CORBA::COMPLETED_NO));
00071 
00072       PortableInterceptor::ORBInitializer_var orb_initializer;
00073       orb_initializer = temp_orb_initializer;
00074 
00075       PortableInterceptor::register_orb_initializer (orb_initializer.in ());
00076     }
00077   catch (const ::CORBA::Exception& ex)
00078     {
00079       ex._tao_print_exception (
00080         "Unexpected exception caught while "
00081         "initializing the Strategies library");
00082       return -1;
00083     }
00084 
00085   return 0;
00086 }


Member Data Documentation

TAO_Optimized_Connection_Endpoint_Selector* TAO_OC_Endpoint_Selector_Factory::oc_endpoint_selector_ [protected]

The possible endpoint selector strategies that can be returned by this factory

Definition at line 74 of file OC_Endpoint_Selector_Factory.h.

Referenced by get_selector(), and ~TAO_OC_Endpoint_Selector_Factory().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:47:32 2010 for TAO_Strategies by  doxygen 1.4.7