3 //=============================================================================
5 * @file Wait_Strategy.h
7 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
9 //=============================================================================
11 #ifndef TAO_WAIT_STRATEGY_H
12 #define TAO_WAIT_STRATEGY_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include /**/ "tao/TAO_Export.h"
23 #include /**/ "tao/Message_Semantics.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 class ACE_Event_Handler
;
28 ACE_END_VERSIONED_NAMESPACE_DECL
30 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
34 class TAO_Synch_Reply_Dispatcher
;
37 * @class TAO_Wait_Strategy
39 * @brief Strategy for waiting for the reply.
41 class TAO_Export TAO_Wait_Strategy
45 explicit TAO_Wait_Strategy (TAO_Transport
*transport
);
48 virtual ~TAO_Wait_Strategy () = default;
51 * The user is going to send a request, prepare any internal
52 * variables because the reply may arrive *before* the user calls
55 virtual int sending_request (TAO_ORB_Core
*orb_core
, TAO_Message_Semantics msg_semantics
);
57 // The ORB finished handling the request; either the reply was received
58 // and dispatched, the request timed out or the connection was closed.
59 virtual void finished_request ();
61 /// Base class virtual method. Wait till the @c reply_received flag is
62 /// true or the time expires.
63 virtual int wait (ACE_Time_Value
*max_wait_time
,
64 TAO_Synch_Reply_Dispatcher
&rd
) = 0;
66 /// Register the handler needs with the reactor provided that it makes
67 /// sense for the strategy.
68 virtual int register_handler () = 0;
70 /// Returns a value to indicate whether the transport needs to set
71 /// the socket on which it is waiting to non-blocking mode or not.
72 virtual bool non_blocking () const = 0;
74 /// Flag that indicates whether we can process requests while
75 /// waiting for the reply.
77 * This flag is to check whether the thread can process upcalls
78 * while waiting for the reply. Some wait strategies, like
79 * Wait_On_LF_No_Upcall does not allow the client threads to process
80 * requests while waiting for the reply.
82 virtual bool can_process_upcalls () const = 0;
84 /// Method to support deffering an upcall event till later in
85 /// cases where can_process_upcalls() returns false.
86 /// Some wait strategies like Wait_On_LF_No_Upcall allow an
87 /// event to be deferred at the Leader_Follower which resumes
88 /// the upcall at an opportune moment (when a new leader thread
90 virtual int defer_upcall (ACE_Event_Handler
*);
92 /// Get method for the flag
93 bool is_registered () const;
95 /// Set method for the flag
96 void is_registered (bool flag
);
100 TAO_Transport
*transport_
;
102 /// Flag to indicate whether the service handler that created the
103 /// above transport has been registered with the reactor or not. The
104 /// default is false.
108 TAO_END_VERSIONED_NAMESPACE_DECL
111 #if defined (__ACE_INLINE__)
112 # include "tao/Wait_Strategy.inl"
113 #endif /* __ACE_INLINE__ */
115 #include /**/ "ace/post.h"
117 #endif /* TAO_WAIT_STRATEGY_H */