3 //=============================================================================
5 * @file Profile_Transport_Resolver.h
7 * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
9 //=============================================================================
11 #ifndef TAO_PROFILE_TRANSPORT_RESOLVER_H
12 #define TAO_PROFILE_TRANSPORT_RESOLVER_H
14 #include /**/ "ace/pre.h"
15 #include "ace/Global_Macros.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Transport_Selection_Guard.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 ACE_END_VERSIONED_NAMESPACE_DECL
27 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 class TAO_Transport_Descriptor_Interface
;
41 typedef Object
*Object_ptr
;
46 class Synch_Twoway_Invocation
;
49 * @class Profile_Transport_Resolver
51 * @brief Chooses the profile and a transport for a target object on
52 * which an invocation can be made.
54 * A target object is represented by multiple profiles, which
55 * theoretically provides multiple paths to the same target
56 * object. This class helps in choosing the right profile, and pick
57 * a transport from cache (or create a new transport if needed) that
58 * represents the profile.
60 class TAO_Export Profile_Transport_Resolver
65 * With @a block we tell whether this resolved should always deliver
66 * a connection by blocking or unblock before the connection is
67 * completely established. Please note that this has *nothing* to
68 * do with the synchronous or asynch connect strategy used for
69 * making connections. This is a local flag used by the clients of
70 * this to dictate some local behavior.
72 Profile_Transport_Resolver (CORBA::Object
*p
,
76 ~Profile_Transport_Resolver ();
78 /// Method where the bunch of the action takes place.
80 * This is the entry point from the TAO::Invocation_Adapter
81 * class. This method accesses the endpoint selector factory from
82 * the ORB_Core to decide on the strategy to be used for selecting
85 void resolve (ACE_Time_Value
*val
);
89 * @name Accessors and mutators for this class. The following methods
90 * are used by the clients of this class to access strategies and
91 * other internal workings.
94 /// Mutator for profile.
95 void profile (TAO_Profile
*pfile
);
97 /// Accessor for profile.
98 TAO_Profile
*profile () const;
100 /// Accessor for TAO_Stub
101 TAO_Stub
*stub () const;
103 /// Accessor for the target in use
104 CORBA::Object
*object () const;
106 /// Accessor for the transport reserved for this invocation.
107 TAO_Transport
*transport () const;
109 /// See if the transport cache has an available transport and
110 /// use that one rather than trying to connect via the connector.
111 /// Separating this functionality enables the look up of many
112 /// endpoints before trying the more time-consuming trip through
113 /// the actual connector.
114 int find_transport (TAO_Transport_Descriptor_Interface
*);
116 /// Accessor to indicate whether we should block while
117 /// establishing a connection.
118 bool blocked_connect () const;
121 /// Signal to let the resolver know that the transport has been
122 /// released back to the cache.
123 void transport_released () const;
125 /// This is a callback method used by the endpoint selectors to
126 /// delegate the responsibility of reserving a transport from the
127 /// connection cache for this invocation. When the descriptor
128 /// contains more than one endpoint (as part of a linked list) and
129 /// the parallel flag is true then the connector will look for a
130 /// connection on any of the endpoints if it supports that
131 /// behavior, otherwise an ENOTSUP errno will be set and the
132 /// method will return false.
133 bool try_connect (TAO_Transport_Descriptor_Interface
*desc
,
134 ACE_Time_Value
*val
);
136 bool try_parallel_connect (TAO_Transport_Descriptor_Interface
*desc
,
137 ACE_Time_Value
*val
);
139 /// This method wraps a call to the orb core to see if parallel
140 /// connection attempts are even desired. This is controlled by
141 /// the -ORBUseParallelConnects 1|0 commandline option.
142 bool use_parallel_connect () const;
144 /// Initialize the inconsistent policy list that this object has
146 void init_inconsistent_policies ();
148 CORBA::PolicyList
*inconsistent_policies () const;
150 CORBA::PolicyList
*steal_inconsistent_policies ();
152 /// Helper method to access get the connection timeout from the
154 bool get_connection_timeout (ACE_Time_Value
&max_wait_time
);
156 void operator= (const Profile_Transport_Resolver
&);
157 Profile_Transport_Resolver (const Profile_Transport_Resolver
&);
160 bool try_connect_i (TAO_Transport_Descriptor_Interface
*desc
,
165 mutable CORBA::Object
*obj_
;
167 /// Stub object for the target object.
170 /// The transport selected for this invocation.
172 /// Using the wrapper guard ensures it is available for use with
173 /// the Transport Current interfaces.
174 TAO::Transport_Selection_Guard transport_
;
176 /// The profile that has been selected for this invocation.
177 TAO_Profile
*profile_
;
179 /// List of inconsistent policies
181 * If current effective policies cause the invocation to raise
182 * CORBA::INV_POLICY exception, the conflicting/problematic policies
183 * are stored in this list. This is used by
184 * Object::_validate_connection() method to inform clients about
185 * causes of invocation failure.
187 * Conflicting policies are only stored in this list if
188 * init_inconsistent_policies() method has been called prior to the
189 * beginning of invocation. This saves extra work of conflicting
190 * policies 'logging' when it's not needed.
192 * @note We don't use _var with a reason. Using _var would
193 * involve including the header file for at least
194 * Policy_ForwardC.h, and that is what we precisely want to
197 CORBA::PolicyList
*inconsistent_policies_
;
199 /// Has the transport been idle?
200 mutable bool is_released_
;
202 /// Should we block while trying to make a connection
205 } // TAO namespace end
207 TAO_END_VERSIONED_NAMESPACE_DECL
209 #if defined (__ACE_INLINE__)
210 # include "tao/Profile_Transport_Resolver.inl"
211 #endif /* __ACE_INLINE__ */
213 #include /**/ "ace/post.h"
215 #endif /*TAO_PROFILE_TRANSPORT_RESOLVER_H*/