2 //=============================================================================
4 * @file Synch_Invocation.h
6 * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
8 //=============================================================================
9 #ifndef TAO_SYNCH_INVOCATION_H
10 #define TAO_SYNCH_INVOCATION_H
11 #include /**/ "ace/pre.h"
13 #include "tao/Remote_Invocation.h"
15 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 #endif /* ACE_LACKS_PRAGMA_ONCE */
19 #include "tao/orbconf.h"
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
23 ACE_END_VERSIONED_NAMESPACE_DECL
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 class TAO_Operation_Details
;
28 class TAO_Synch_Reply_Dispatcher
;
30 class TAO_Bind_Dispatcher_Guard
;
34 class Profile_Transport_Resolver
;
35 class Invocation_Retry_State
;
38 * @class Synch_Twoway_Invocation
40 * @brief All the action for a synchronous twoway invocation happen
43 * An object of this type is created by TAO::Invocation_Adapter
44 * and invokes a method on this class. The method takes care of
45 * creating and sending a request, waiting for a reply and
46 * demarshalling the reply for the client.
49 class TAO_Export Synch_Twoway_Invocation
: public Remote_Invocation
52 /// Constructor used by TAO::Invocation_Adapter
54 * @param otarget The original target on which this invocation
55 * was started. This is there to be passed up to its parent
58 * @param resolver The profile and transport holder.
60 * @param detail Operation details of the invocation on the target
62 * @param response_expected Flag to indicate whether the
63 * operation encapsulated by @a op returns a response or not.
65 Synch_Twoway_Invocation (CORBA::Object_ptr otarget
,
66 Profile_Transport_Resolver
&resolver
,
67 TAO_Operation_Details
&detail
,
68 bool response_expected
= true);
70 /// Method used by the adapter to kickstart an invocation to the
73 * There is a exception declaration in this method which ensures
74 * that the exceptions propagated by the remote objects are
75 * converted a CORBA exceptions for the clients. This method does
76 * a bunch of things necessary to create and send the
77 * invocation. This method is also nerve centre for the
78 * interceptor invocation points.
80 Invocation_Status
remote_twoway (ACE_Time_Value
*max_wait_time
);
83 * Indicate that retry state should be tracked and controlled
84 * in the presence of exceptions.
86 void set_retry_state (Invocation_Retry_State
*retry_state
);
90 * This method is selectively made virtual, so that inherited
91 * classes can overload the user exception handling type. For
92 * example the DII needs a totally different method of
93 * user exception exception handling
95 virtual Invocation_Status
handle_user_exception (TAO_InputCDR
&cdr
);
97 /// Helper method used to handle location forwarded replies.
98 Invocation_Status
location_forward (TAO_InputCDR
&cdr
);
100 /// Helper method used to handle system exceptions from the remote
102 Invocation_Status
handle_system_exception (TAO_InputCDR
&cdr
);
104 /// As the name suggests waits for a reply from the remote ORB.
106 * This method returns an exception when there is an error.
108 Invocation_Status
wait_for_reply (ACE_Time_Value
*max_wait_time
,
109 TAO_Synch_Reply_Dispatcher
&rd
,
110 TAO_Bind_Dispatcher_Guard
&bd
);
112 Invocation_Retry_State
*retry_state_
;
115 /// Helper method that checks the reply status of the
116 /// replies and takes appropriate action.
118 * This method returns an exception when there is an error.
120 Invocation_Status
check_reply_status (TAO_Synch_Reply_Dispatcher
&rd
);
124 * @class Synch_Oneway_Invocation
126 * @brief All the action for a synchronous oneway invocation happen
129 * This class inherits from twoway invocation for the following
132 * - We deal with oneway invocation in more or less the same way as
133 * two but for waiting for the reply
135 * - For some SYNC_SCOPE policies namely SYNC_WITH_TARGET and
136 * SYNC_WITH_SERVER the invocation classes have to treat the
137 * invocation as a twoway invocation (more or less)
139 class TAO_Export Synch_Oneway_Invocation
140 : public Synch_Twoway_Invocation
143 /// Constructor used by TAO::Invocation_Adapter
145 * @param otarget The original target on which this invocation
146 * was started. This is there to be passed up to its parent
149 * @param resolver The profile and transport holder.
151 * @param detail Operation details of the invocation on the target
153 Synch_Oneway_Invocation (CORBA::Object_ptr otarget
,
154 Profile_Transport_Resolver
&resolver
,
155 TAO_Operation_Details
&detail
);
157 /// Method used by the adapter to kickstart an oneway invocation
158 /// to the remote object.
159 Invocation_Status
remote_oneway (ACE_Time_Value
*max_wait_time
);
165 * @brief A guard class used for storing and forwarding the reply
166 * status to the portable interceptors.
168 class TAO_Export Reply_Guard
171 Reply_Guard (Invocation_Base
*s
, Invocation_Status is
);
173 /// The destructor calls Invocation_Base::invoke_status with the
174 /// right invoke status, which is useful for PI's.
177 /// Mutator to set the invocation status.
178 void set_status (Invocation_Status s
);
181 Reply_Guard (Reply_Guard
const &);
182 Reply_Guard
& operator= (Reply_Guard
const &);
185 Invocation_Base
* const invocation_
;
186 Invocation_Status status_
;
190 TAO_END_VERSIONED_NAMESPACE_DECL
192 #if defined (__ACE_INLINE__)
193 # include "tao/Synch_Invocation.inl"
194 #endif /* __ACE_INLINE__ */
196 #include /**/ "ace/post.h"
197 #endif /*TAO_SYNCH_INVOCATION_H*/