1 #include "tao/Invocation_Endpoint_Selectors.h"
3 #include "tao/Profile.h"
4 #include "tao/ORB_Core.h"
5 #include "tao/IIOP_Endpoint.h"
6 #include "tao/Base_Transport_Property.h"
7 #include "tao/Profile_Transport_Resolver.h"
8 #include "tao/ORB_Constants.h"
9 #include "tao/SystemException.h"
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_Invocation_Endpoint_Selector::~TAO_Invocation_Endpoint_Selector ()
17 // ****************************************************************
19 TAO_Default_Endpoint_Selector::~TAO_Default_Endpoint_Selector ()
24 TAO_Default_Endpoint_Selector::select_endpoint (TAO::Profile_Transport_Resolver
*r
,
25 ACE_Time_Value
*max_wait_time
)
29 r
->profile (r
->stub ()->profile_in_use ());
31 // Check whether we need to do a blocked wait or we have a
32 // non-blocked wait and we support that. If this is not the
33 // case we can't use this profile so try the next.
34 if (r
->blocked_connect () ||
35 (!r
->blocked_connect () &&
36 r
->profile ()->supports_non_blocking_oneways ()))
38 if (r
->profile ()->endpoint_count () > 1 &&
39 r
->use_parallel_connect())
41 TAO_Endpoint
*ep
= r
->profile ()->endpoint ();
43 TAO_Base_Transport_Property
desc (ep
);
45 // Check if the connect has completed.
46 if (r
->try_parallel_connect (&desc
, max_wait_time
))
48 // The default implementation of try_parallel_connect returns
49 // a not supported errno. In this case, allow the ordinary
50 // connection mechanism to be tried. OTOH, if the connection
51 // attempt failed for some other reason, then abandon this
52 // profile and try the next one in the list.
53 else if (errno
!= ENOTSUP
)
57 for (TAO_Endpoint
*ep
= r
->profile ()->first_filtered_endpoint ();
59 ep
= r
->profile ()->next_filtered_endpoint (ep
))
61 TAO_Base_Transport_Property
desc (ep
);
63 // Check if the connect has completed.
64 if (r
->try_connect (&desc
, max_wait_time
))
69 while (r
->stub ()->next_profile_retry () != 0);
71 // If we get here, we completely failed to find an endpoint
72 // that we know how to use. We used to throw an exception
73 // but that would prevent any request interception points
74 // being called. They may know how to fix the problem so
75 // we wait to throw the exception in
76 // Synch_Twoway_Invocation::remote_twoway and
77 // Synch_Oneway_Invocation::remote_oneway instead.
80 TAO_END_VERSIONED_NAMESPACE_DECL