Invocation_Endpoint_Selectors.cpp

Go to the documentation of this file.
00001 //Invocation_Endpoint_Selectors.cpp,v 1.38 2006/04/26 17:12:47 mesnier_p Exp
00002 #include "tao/Invocation_Endpoint_Selectors.h"
00003 #include "tao/Stub.h"
00004 #include "tao/Profile.h"
00005 #include "tao/ORB_Core.h"
00006 #include "tao/IIOP_Endpoint.h"
00007 #include "tao/Base_Transport_Property.h"
00008 #include "tao/Profile_Transport_Resolver.h"
00009 #include "tao/ORB_Constants.h"
00010 #include "tao/SystemException.h"
00011 
00012 ACE_RCSID (tao,
00013            Invocation_Endpoint_Selectors,
00014            "Invocation_Endpoint_Selectors.cpp,v 1.38 2006/04/26 17:12:47 mesnier_p Exp")
00015 
00016 
00017   TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 TAO_Invocation_Endpoint_Selector::~TAO_Invocation_Endpoint_Selector (void)
00020 {
00021 }
00022 
00023 // ****************************************************************
00024 
00025 TAO_Default_Endpoint_Selector::~TAO_Default_Endpoint_Selector (void)
00026 {
00027 }
00028 
00029 void
00030 TAO_Default_Endpoint_Selector::select_endpoint (TAO::Profile_Transport_Resolver *r,
00031                                                 ACE_Time_Value *max_wait_time
00032                                                 ACE_ENV_ARG_DECL)
00033 {
00034   do
00035     {
00036       r->profile (r->stub ()->profile_in_use ());
00037 
00038       // Check whether we need to do a blocked wait or we have a
00039       // non-blocked wait and we support that.  If this is not the
00040       // case we can't use this profile so try the next.
00041       if (r->blocked_connect () ||
00042           (!r->blocked_connect () &&
00043            r->profile ()->supports_non_blocking_oneways ()))
00044         {
00045           if (r->profile ()->endpoint_count () > 1 &&
00046               r->use_parallel_connect())
00047             {
00048 
00049               TAO_Endpoint *ep =
00050                 r->profile ()->endpoint ();
00051 
00052               TAO_Base_Transport_Property desc (ep);
00053               bool success =
00054                 r->try_parallel_connect (&desc,
00055                                          max_wait_time
00056                                          ACE_ENV_ARG_PARAMETER);
00057               ACE_CHECK;
00058 
00059               // Check if the connect has completed.
00060               if (success)
00061                 return;
00062               // The default implementation of try_parallel_connect returns
00063               // a not supported errno. In this case, allow the ordinary
00064               // connection mechanism to be tried. OTOH, if the connection
00065               // attempt failed for some other reason, then abandon this
00066               // profile and try the next one in the list.
00067               else if (errno != ENOTSUP)
00068                 continue;
00069             }
00070 
00071           for (TAO_Endpoint *ep = r->profile ()->first_filtered_endpoint ();
00072                ep != 0;
00073                ep = r->profile ()->next_filtered_endpoint (ep))
00074             {
00075               TAO_Base_Transport_Property desc (ep);
00076               bool retval =
00077                 r->try_connect (&desc,
00078                                 max_wait_time
00079                                 ACE_ENV_ARG_PARAMETER);
00080               ACE_CHECK;
00081 
00082               // Check if the connect has completed.
00083               if (retval)
00084                 return;
00085             }
00086 
00087         }
00088     }
00089   while (r->stub ()->next_profile_retry () != 0);
00090 
00091 
00092   // If we get here, we completely failed to find an endpoint selector
00093   // that we know how to use, so throw an exception.
00094   ACE_THROW (CORBA::TRANSIENT (CORBA::OMGVMCID | 2,
00095                                CORBA::COMPLETED_NO));
00096 }
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 11:54:14 2006 for TAO by doxygen 1.3.6