diff options
Diffstat (limited to 'TAO/tao/Wait_Strategy.h')
-rw-r--r-- | TAO/tao/Wait_Strategy.h | 118 |
1 files changed, 106 insertions, 12 deletions
diff --git a/TAO/tao/Wait_Strategy.h b/TAO/tao/Wait_Strategy.h index 0cc8ea91ade..12a690c82db 100644 --- a/TAO/tao/Wait_Strategy.h +++ b/TAO/tao/Wait_Strategy.h @@ -22,10 +22,6 @@ #include "tao/corbafwd.h" -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - class TAO_ORB_Core; class TAO_Transport; class TAO_Transport_Mux_Strategy; @@ -52,8 +48,10 @@ public: // variables because the reply may arrive *before* the user calls // wait. - virtual int wait (ACE_Time_Value *max_wait_time) = 0; - // Base class virtual method. + virtual int wait (ACE_Time_Value *max_wait_time, + int &reply_received) = 0; + // 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. @@ -62,6 +60,11 @@ public: // Register the handler with the Reactor if it makes sense for the // strategy. + virtual ACE_SYNCH_CONDITION *leader_follower_condition_variable (void); + // Return the TSS leader follower condition variable used in the + // Wait Strategy. Muxed Leader Follower implementation returns a + // valid condition variable, others return 0. + protected: TAO_Transport *transport_; // Transport object. @@ -69,7 +72,9 @@ protected: // @@ Alex: we should consider moving these classes to separate files, // that can minimize the footprint of systems that use only one of -// the strategies.... +// the strategies....(coryan). + +// ********************************************************************* class TAO_Export TAO_Wait_On_Reactor : public TAO_Wait_Strategy { @@ -90,16 +95,19 @@ public: // = Documented in TAO_Wait_Strategy. - virtual int wait (ACE_Time_Value *max_wait_time); + 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_; + // 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 @@ -117,14 +125,53 @@ public: 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); + virtual int wait (ACE_Time_Value *max_wait_time, + int &reply_received); virtual int handle_input (void); - virtual int register_handler (void); + // virtual int register_handler (void); protected: ACE_SYNCH_CONDITION* cond_response_available (void); @@ -151,6 +198,50 @@ protected: // 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 @@ -166,7 +257,10 @@ public: virtual ~TAO_Wait_On_Read (void); // Destructor. - virtual int wait (ACE_Time_Value *max_wait_time); + // = 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); }; |