Public Member Functions | Protected Member Functions | Protected Attributes

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_Selector
get_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_OC_Endpoint_Selector_Factory::TAO_OC_Endpoint_Selector_Factory ( void   ) 

Constructor.

Definition at line 18 of file OC_Endpoint_Selector_Factory.cpp.

TAO_OC_Endpoint_Selector_Factory::~TAO_OC_Endpoint_Selector_Factory ( void   )  [virtual]

Destructor.

Definition at line 23 of file OC_Endpoint_Selector_Factory.cpp.

{
  delete this->oc_endpoint_selector_;
}


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.

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

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.

{
  ACE_Time_Value connect_timeout(0,0);

  for (int count = 0; count < argc; count++)
    {
      if ((ACE_OS::strcasecmp (argv[count],
                               ACE_TEXT ("-connect_timeout")) == 0) &&
          count < argc-1)
        {
          ++count;
          long const ms = ACE_OS::strtol(argv[count],0,10);
          connect_timeout.msec (ms);
        }
    }

  if (this->register_orb_initializer () == -1)
    return -1;

  ACE_NEW_RETURN (this->oc_endpoint_selector_,
                  TAO_Optimized_Connection_Endpoint_Selector(connect_timeout),
                  -1);
  return 0;
}

int TAO_OC_Endpoint_Selector_Factory::register_orb_initializer ( void   )  [protected]

Register the RTCORBA ORBInitializer.

Definition at line 55 of file OC_Endpoint_Selector_Factory.cpp.

{
  // Register the ORB initializer.
  try
    {
      PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
        PortableInterceptor::ORBInitializer::_nil ();

      /// Register the RTCORBA ORBInitializer.
      ACE_NEW_THROW_EX (temp_orb_initializer,
                        TAO_Strategies_ORBInitializer,
                        CORBA::NO_MEMORY (
                          CORBA::SystemException::_tao_minor_code (
                            TAO::VMCID,
                            ENOMEM),
                          CORBA::COMPLETED_NO));

      PortableInterceptor::ORBInitializer_var orb_initializer;
      orb_initializer = temp_orb_initializer;

      PortableInterceptor::register_orb_initializer (orb_initializer.in ());
    }
  catch (const ::CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "Unexpected exception caught while "
        "initializing the Strategies library");
      return -1;
    }

  return 0;
}


Member Data Documentation

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

Definition at line 74 of file OC_Endpoint_Selector_Factory.h.


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