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

TAO_Default_Endpoint_Selector Class Reference

Default strategy for endpoint selection. More...

#include <Invocation_Endpoint_Selectors.h>

Inheritance diagram for TAO_Default_Endpoint_Selector:

Inheritance graph
[legend]
Collaboration diagram for TAO_Default_Endpoint_Selector:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_Default_Endpoint_Selector (void)
 Constructor. More...

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

virtual void select_endpoint (TAO_GIOP_Invocation *invocation ACE_ENV_ARG_DECL)
 Select the endpoint and set <invocation>'s <profile_> and <endpoint_> data members accordingly. More...

virtual void forward (TAO_GIOP_Invocation *invocation, const TAO_MProfile &mprofile ACE_ENV_ARG_DECL)
virtual void success (TAO_GIOP_Invocation *invocation)
 Update the state to indicate that the selected endpoint/profile were used successfully. More...

virtual void close_connection (TAO_GIOP_Invocation *invocation)
 Update the state to reflect that the connection being used for the invocation has been closed by the server. More...


Protected Methods

virtual int endpoint_from_profile (TAO_GIOP_Invocation *invocation ACE_ENV_ARG_DECL)
 This method selects an endpoint from the profile in the invocation object. More...


Detailed Description

Default strategy for endpoint selection.

This strategy is used when there are no policies set or when the only policy set is RTCORBA::PriorityModelPolicy and its value is RTCORBA::SERVER_DECLARED. The strategy is to try the first endpoint from the first profile in the IOR. If that doesn't work, try the next profile, and so on.

Definition at line 91 of file Invocation_Endpoint_Selectors.h.


Constructor & Destructor Documentation

TAO_Default_Endpoint_Selector::TAO_Default_Endpoint_Selector void   
 

Constructor.

Definition at line 30 of file Invocation_Endpoint_Selectors.cpp.

00031 {
00032 }

TAO_Default_Endpoint_Selector::~TAO_Default_Endpoint_Selector void    [virtual]
 

Destructor.

Definition at line 34 of file Invocation_Endpoint_Selectors.cpp.

00035 {
00036 }


Member Function Documentation

void TAO_Default_Endpoint_Selector::close_connection TAO_GIOP_Invocation   invocation [virtual]
 

Update the state to reflect that the connection being used for the invocation has been closed by the server.

Implements TAO_Invocation_Endpoint_Selector.

Definition at line 91 of file Invocation_Endpoint_Selectors.cpp.

References TAO_Stub::reset_profiles, and TAO_GIOP_Invocation::stub.

00092 {
00093   // Get rid of any forwarding profiles and reset
00094   // the profile list to point to the first profile!
00095   // FRED For now we will not deal with recursive forwards!
00096   invocation->stub ()->reset_profiles ();
00097 }

int TAO_Default_Endpoint_Selector::endpoint_from_profile TAO_GIOP_Invocation *invocation    ACE_ENV_ARG_DECL [protected, virtual]
 

This method selects an endpoint from the profile in the invocation object.

Definition at line 101 of file Invocation_Endpoint_Selectors.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, and ACE_ENV_ARG_PARAMETER.

Referenced by select_endpoint.

00104 {
00105   size_t endpoint_count =
00106     invocation->profile ()->endpoint_count();
00107 
00108   for (size_t i = 0; i < endpoint_count; ++i)
00109     {
00110       // If known endpoint, select it.
00111       if (invocation->endpoint () != 0)
00112         {
00113           TAO_Base_Transport_Property desc (invocation->endpoint ());
00114 
00115           int status =
00116             invocation->perform_call (desc ACE_ENV_ARG_PARAMETER);
00117           ACE_CHECK_RETURN (-1);
00118 
00119           // Check if the invocation has completed.
00120           if (status == 1)
00121             return 1;
00122 
00123           // Go to the next endpoint in this profile.
00124           invocation->endpoint (invocation->endpoint()->next());
00125         }
00126     }
00127 
00128   return 0;
00129 }

void TAO_Default_Endpoint_Selector::forward TAO_GIOP_Invocation   invocation,
const TAO_MProfile &mprofile    ACE_ENV_ARG_DECL
[virtual]
 

This method must be called if the invocation attempt on a selected endpoint resulted in location forward. This method performs the necessary state updates, so that next <select_endpoint> call picks a new endpoint.

Implements TAO_Invocation_Endpoint_Selector.

Definition at line 64 of file Invocation_Endpoint_Selectors.cpp.

References CORBA_SystemException::_tao_minor_code, ACE_ENV_ARG_DECL, ACE_THROW, TAO_Stub::add_forward_profiles, TAO_Stub::next_profile, TAO_GIOP_Invocation::stub, and TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE.

00067 {
00068   invocation->stub ()->add_forward_profiles (mprofile);
00069   // This has to be and is thread safe.
00070   // TAO_Stub::add_forward_profiles() already makes a copy of the
00071   // MProfile, so do not make a copy here.
00072 
00073 
00074   // We may not need to do this since TAO_GIOP_Invocations
00075   // get created on a per-call basis. For now we'll play it safe.
00076   if (invocation->stub ()->next_profile () == 0)
00077     ACE_THROW (CORBA::TRANSIENT (
00078       CORBA_SystemException::_tao_minor_code (
00079         TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
00080         errno),
00081       CORBA::COMPLETED_NO));
00082 }

void TAO_Default_Endpoint_Selector::select_endpoint TAO_GIOP_Invocation *invocation    ACE_ENV_ARG_DECL [virtual]
 

Select the endpoint and set <invocation>'s <profile_> and <endpoint_> data members accordingly.

Implements TAO_Invocation_Endpoint_Selector.

Definition at line 39 of file Invocation_Endpoint_Selectors.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW, and endpoint_from_profile.

00042 {
00043   do
00044     {
00045       invocation->profile (invocation->stub ()->profile_in_use ());
00046       invocation->endpoint (invocation->profile ()->endpoint ());
00047 
00048       int status =
00049         this->endpoint_from_profile (invocation ACE_ENV_ARG_PARAMETER);
00050       ACE_CHECK;
00051 
00052       if (status == 1)
00053         return;
00054     }
00055   while (invocation->stub ()->next_profile_retry () != 0);
00056 
00057   // If we get here, we completely failed to find an endpoint selector
00058   // that we know how to use, so throw an exception.
00059   ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
00060                                CORBA::COMPLETED_NO));
00061 }

void TAO_Default_Endpoint_Selector::success TAO_GIOP_Invocation   invocation [virtual]
 

Update the state to indicate that the selected endpoint/profile were used successfully.

Implements TAO_Invocation_Endpoint_Selector.

Definition at line 85 of file Invocation_Endpoint_Selectors.cpp.

References TAO_Stub::set_valid_profile, and TAO_GIOP_Invocation::stub.

00086 {
00087   invocation->stub ()->set_valid_profile ();
00088 }


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