Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / Wait_Strategy.h
blob34fdab5d18469f4a6645903fd24e696d1ca0af37
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Wait_Strategy.h
7 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
8 */
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)
19 # 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
26 class ACE_Time_Value;
27 class ACE_Event_Handler;
28 ACE_END_VERSIONED_NAMESPACE_DECL
30 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 class TAO_ORB_Core;
33 class TAO_Transport;
34 class TAO_Synch_Reply_Dispatcher;
36 /**
37 * @class TAO_Wait_Strategy
39 * @brief Strategy for waiting for the reply.
41 class TAO_Export TAO_Wait_Strategy
44 public:
45 /// Constructor.
46 explicit TAO_Wait_Strategy (TAO_Transport *transport);
48 /// Destructor.
49 virtual ~TAO_Wait_Strategy ();
51 /**
52 * The user is going to send a request, prepare any internal
53 * variables because the reply may arrive *before* the user calls
54 * wait.
56 virtual int sending_request (TAO_ORB_Core *orb_core, TAO_Message_Semantics msg_semantics);
58 // The ORB finished handling the request; either the reply was received
59 // and dispatched, the request timed out or the connection was closed.
60 virtual void finished_request ();
62 /// Base class virtual method. Wait till the @c reply_received flag is
63 /// true or the time expires.
64 virtual int wait (ACE_Time_Value *max_wait_time,
65 TAO_Synch_Reply_Dispatcher &rd) = 0;
67 /// Register the handler needs with the reactor provided that it makes
68 /// sense for the strategy.
69 virtual int register_handler () = 0;
71 /// Returns a value to indicate whether the transport needs to set
72 /// the socket on which it is waiting to non-blocking mode or not.
73 virtual bool non_blocking () const = 0;
75 /// Flag that indicates whether we can process requests while
76 /// waiting for the reply.
77 /**
78 * This flag is to check whether the thread can process upcalls
79 * while waiting for the reply. Some wait strategies, like
80 * Wait_On_LF_No_Upcall does not allow the client threads to process
81 * requests while waiting for the reply.
83 virtual bool can_process_upcalls () const = 0;
85 /// Method to support deffering an upcall event till later in
86 /// cases where can_process_upcalls() returns false.
87 /// Some wait strategies like Wait_On_LF_No_Upcall allow an
88 /// event to be deferred at the Leader_Follower which resumes
89 /// the upcall at an opportune moment (when a new leader thread
90 /// is activated).
91 virtual int defer_upcall (ACE_Event_Handler*);
93 /// Get method for the flag
94 bool is_registered () const;
96 /// Set method for the flag
97 void is_registered (bool flag);
99 protected:
100 /// Transport object.
101 TAO_Transport *transport_;
103 /// Flag to indicate whether the service handler that created the
104 /// above transport has been registered with the reactor or not. The
105 /// default is false.
106 bool is_registered_;
109 TAO_END_VERSIONED_NAMESPACE_DECL
112 #if defined (__ACE_INLINE__)
113 # include "tao/Wait_Strategy.inl"
114 #endif /* __ACE_INLINE__ */
116 #include /**/ "ace/post.h"
118 #endif /* TAO_WAIT_STRATEGY_H */