summaryrefslogtreecommitdiff
path: root/TAO/tao/Wait_Strategy.h
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-06-16 20:15:25 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-06-16 20:15:25 +0000
commit99bb6fb665611ddd98a71c75d9f33bfd0c1d7c9b (patch)
tree9d6733547f5f42ea89ded14110c3d1ae1e61d484 /TAO/tao/Wait_Strategy.h
parent135a5704b855f6be64fb62c4dee40cd566348df2 (diff)
downloadATCD-99bb6fb665611ddd98a71c75d9f33bfd0c1d7c9b.tar.gz
ChangeLogTag:Fri Jun 16 12:07:39 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'TAO/tao/Wait_Strategy.h')
-rw-r--r--TAO/tao/Wait_Strategy.h225
1 files changed, 20 insertions, 205 deletions
diff --git a/TAO/tao/Wait_Strategy.h b/TAO/tao/Wait_Strategy.h
index 09496aed1e3..ecbe7fe2105 100644
--- a/TAO/tao/Wait_Strategy.h
+++ b/TAO/tao/Wait_Strategy.h
@@ -6,12 +6,6 @@
// = LIBRARY
// TAO
//
-// = FILENAME
-// Wait_Strategy.h
-//
-// = DESCRIPTION
-// Classes to strategize waiting for reply.
-//
// = AUTHOR
// Alexander Babu Arulanthu <alex@cs.wustl.edu>
//
@@ -29,7 +23,6 @@
class TAO_ORB_Core;
class TAO_Transport;
-class TAO_Transport_Mux_Strategy;
class TAO_Export TAO_Wait_Strategy
{
@@ -58,9 +51,6 @@ public:
// Base class virtual method. Wait till the <reply_received> flag is
// true or the time expires.
- virtual int handle_input (void) = 0;
- // Handle the input.
-
virtual int register_handler (void) = 0;
// Register the handler with the Reactor if it makes sense for the
// strategy.
@@ -69,206 +59,31 @@ public:
// Return the TSS leader follower condition variable used in the
// Wait Strategy. Muxed Leader Follower implementation returns a
// valid condition variable, others return 0.
+ // The condition variable is acquired by the Reply_Dispatcher (when
+ // needed) in the thread that binds it to the right Transport.
+ // Later (when the reply is finally received) the Reply_Dispatcher
+ // passes this condition variable back to Waiting_Strategy, that can
+ // then signal the waiting thread if needed.
+
+ virtual int reply_dispatched (int &reply_received_flag,
+ ACE_SYNCH_CONDITION *);
+ // This is the callback used by the Reply_Dispatcher to inform the
+ // Waiting_Strategy that a reply has been completely received, that
+ // it was already stored in the right place, and that the condition
+ // variable should be signalled if needed.
+ // The Waiting_Strategy must set the reply received flag, using
+ // whatever locks it needs.
+
+ virtual void connection_closed (int &reply_received_flag,
+ ACE_SYNCH_CONDITION*);
+ // The connection has been closed by the lower level components in
+ // the ORB.
+ // The wait has finished and must result in an error.
protected:
TAO_Transport *transport_;
// Transport object.
};
-// @@ Alex: we should consider moving these classes to separate files,
-// that can minimize the footprint of systems that use only one of
-// the strategies....(coryan).
-
-// *********************************************************************
-
-class TAO_Export TAO_Wait_On_Reactor : public TAO_Wait_Strategy
-{
- // = TITLE
- //
- // Wait on the Reactor. Happens in s Single Threaded client
- // environment.
- //
- // = DESCRIPTION
- //
-
-public:
- TAO_Wait_On_Reactor (TAO_Transport *transport);
- // Constructor.
-
- virtual ~TAO_Wait_On_Reactor (void);
- // Destructor.
-
- // = Documented in TAO_Wait_Strategy.
-
- virtual int wait (ACE_Time_Value *max_wait_time,
- int &reply_received);
- virtual int handle_input (void);
- virtual int register_handler (void);
-
-private:
- // int reply_received_;
- // This flag indicates if a *complete* reply has been received. Used
- // to exit the event loop.
-};
-
-// *********************************************************************
-
-class TAO_Export TAO_Wait_On_Leader_Follower : public TAO_Wait_Strategy
-{
- // = TITLE
- //
- // Wait according to the Leader-Follower model. Leader does the
- // event loop of the Reactor and the Followers wait on the
- // condition variable.
- //
- // = DESCRIPTION
- //
-
-public:
- TAO_Wait_On_Leader_Follower (TAO_Transport *transport);
- // Constructor.
-
- virtual ~TAO_Wait_On_Leader_Follower (void);
- // Destructor.
-
- // = Documented in TAO_Wait_Strategy.
-
- // virtual int sending_request (TAO_ORB_Core *orb_core,
- // int two_way);
-
- // virtual int wait (ACE_Time_Value *max_wait_time,
- // int &reply_received);
-
- // virtual int handle_input (void);
-
- virtual int register_handler (void);
-};
-
-// *********************************************************************
-
-class TAO_Export TAO_Exclusive_Wait_On_Leader_Follower : public TAO_Wait_On_Leader_Follower
-{
- // = TITLE
- //
- // Wait according to the Leader-Follower model. Leader does the
- // event loop of the Reactor and the Followers wait on the
- // condition variable.
- //
- // = DESCRIPTION
- //
- // This is strategy is to work with the Exclusive Transport Mux
- // Strategy. This was the original implementation of Leader
- // Follower before Muxed Transport was introduced. Here the
- // state variables such as Condition Variable etc are kept in
- // the <Wait Strategy> which is a per Transport object.
-
-public:
- TAO_Exclusive_Wait_On_Leader_Follower (TAO_Transport *transport);
- // Constructor.
-
- virtual ~TAO_Exclusive_Wait_On_Leader_Follower (void);
- // Destructor.
-
- // = Documented in TAO_Wait_Strategy.
-
- virtual int sending_request (TAO_ORB_Core *orb_core,
- int two_way);
- virtual int wait (ACE_Time_Value *max_wait_time,
- int &reply_received);
- virtual int handle_input (void);
- // virtual int register_handler (void);
-
-protected:
- ACE_SYNCH_CONDITION* cond_response_available (void);
- // Return the cond_response_available, initializing it if
- // necessary.
-
- void wake_up (void);
- // Helper method to wake us up when we are a follower...
-
-protected:
- ACE_thread_t calling_thread_;
- // the thread ID of the thread we were running in.
-
- ACE_SYNCH_CONDITION* cond_response_available_;
- // wait on reponse if the leader-follower model is active.
-
- int expecting_response_;
- // State flag which, if non-zero, indicates that we were expecting
- // respose. Otherwise, any input received is unexpected.
-
- int reply_received_;
- // This flag indicates if a *complete* reply was received. Until
- // that happens we block on the leader/follower condition variable
- // or the reactor event loop.
-};
-
-// *********************************************************************
-
-class TAO_Export TAO_Muxed_Wait_On_Leader_Follower : public TAO_Wait_On_Leader_Follower
-{
- // = TITLE
- //
- // Wait according to the Leader-Follower model. Leader does the
- // event loop of the Reactor and the Followers wait on the
- // condition variable.
- //
- // = DESCRIPTION
- //
- // This impelementation is to work with the Muxed Transport
- // Mechanism. Here the state variables such as <Condition
- // Variable> etc cannot be kept in the Wait Strategy, since the
- // Wait Strategy is per Transport object and here the Transport
- // is Muxed and hence there are multiple threads running in the
- // same Transport context.
-
-public:
- TAO_Muxed_Wait_On_Leader_Follower (TAO_Transport *transport);
- // Constructor.
-
- virtual ~TAO_Muxed_Wait_On_Leader_Follower (void);
- // Destructor.
-
- // = Documented in TAO_Wait_Strategy.
-
- virtual int sending_request (TAO_ORB_Core *orb_core,
- int two_way);
-
- virtual int wait (ACE_Time_Value *max_wait_time,
- int &reply_received);
-
- virtual int handle_input (void);
-
- // virtual int register_handler (void);
-
- virtual ACE_SYNCH_CONDITION *leader_follower_condition_variable (void);
- // TSS Leader follower condition variable.
-};
-
-// *********************************************************************
-
-class TAO_Export TAO_Wait_On_Read : public TAO_Wait_Strategy
-{
- // = TITLE
- //
- // = DESCRIPTION
- // Simply block on read() to wait for the reply.
- //
-
-public:
- TAO_Wait_On_Read (TAO_Transport *transport);
- // Constructor.
-
- virtual ~TAO_Wait_On_Read (void);
- // Destructor.
-
- // = Documented in TAO_Wait_Strategy.
-
- virtual int wait (ACE_Time_Value *max_wait_time,
- int &reply_received);
- virtual int handle_input (void);
- virtual int register_handler (void);
-};
-
#include "ace/post.h"
#endif /* TAO_WAIT_STRATEGY_H */