diff options
author | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-06-12 18:58:44 +0000 |
---|---|---|
committer | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-06-12 18:58:44 +0000 |
commit | 849ed197c824efc0c79eace4ebb1b58233ad5307 (patch) | |
tree | 468291519f5de84e2d73520262cff279db26aa67 /TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h | |
parent | 5070be68f08f53deaee31754020ab36c0391af79 (diff) | |
download | ATCD-849ed197c824efc0c79eace4ebb1b58233ad5307.tar.gz |
Tue Jun 12 13:30:02 2001 Frank Hunleth <fhunleth@cs.wustl.edu>, Angelo Corsaro <corsaro@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h')
-rw-r--r-- | TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h new file mode 100644 index 00000000000..874f407af5b --- /dev/null +++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h @@ -0,0 +1,122 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file RT_Servant_Dispatcher.h + * + * $Id$ + * + * @author Frank Hunleth (fhunleth@cs.wustl.edu) + */ +//============================================================================= + + +#ifndef TAO_RT_SERVANT_DISPATCHER_H +#define TAO_RT_SERVANT_DISPATCHER_H +#include "ace/pre.h" + +#include "rtportableserver_export.h" +#include "tao/PortableServer/Servant_Dispatcher.h" +#include "tao/RTCORBA/RTCORBA.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Forward references. +class TAO_Service_Context; + +/** + * @class TAO_RT_Servant_Dispatcher + * + * @brief Concrete instantiation of the Servant_Dispatcher strategy. + * + * + */ +class TAO_RTPortableServer_Export TAO_RT_Servant_Dispatcher + : public TAO_Servant_Dispatcher +{ +public: + virtual ~TAO_RT_Servant_Dispatcher (void); + + /// Dispatch the request to the servant. + virtual void dispatch (TAO_Object_Adapter::Servant_Upcall &servant_upcall, + TAO_ServerRequest &req, + CORBA::Environment &ACE_TRY_ENV); + + /// Factory method for creating new POA's. + virtual TAO_POA *create_POA (const ACE_CString &name, + TAO_POA_Manager &poa_manager, + const TAO_POA_Policy_Set &policies, + TAO_POA *parent, + ACE_Lock &lock, + TAO_SYNCH_MUTEX &thread_lock, + TAO_ORB_Core &orb_core, + TAO_Object_Adapter *object_adapter, + CORBA_Environment &ACE_TRY_ENV); +}; + +/** + * @class RT_Priority_Model_Processing + * + * @brief + * + * This class encapsulates processing necessary for + * RTCORBA CLIENT_PROPAGATED priority model. + * + * Although the destructor of this class resets the priority of + * the thread to it's original value, application should use + * <post_invoke> method for that purpose: destructor cannot + * propagate possible exceptions to the callee. Destructor's + * reset capability is intended as a last resort, i.e., if + * <post_invoke> isn't reached for some reason. + */ +class TAO_RTPortableServer_Export RT_Priority_Model_Processing +{ +public: + + // Constructor. + RT_Priority_Model_Processing (TAO_POA &poa); + + // Resets the priority of the current thread back to its original + // value if necessary, i.e., if it was changed and the + // <post_invoke> method hasn't been called. Unlike <post_invoke>, + // this method cannot propagate exceptions to the user. + ~RT_Priority_Model_Processing (void); + + // Checks if target POA supports RTCORBA::CLIENT_PROPAGATED + // PriorityModel. If so, stores the original priority of the + // current thread, and sets the thread to the client-propagated + // priority. + void pre_invoke (TAO_Service_Context &request_service_context, + TAO_Service_Context &reply_service_context, + CORBA::Environment &ACE_TRY_ENV); + + // Resets the priority of the current thread back to its original + // value, if necessary. + void post_invoke (CORBA::Environment &ACE_TRY_ENV); + +private: + + RT_Priority_Model_Processing (const RT_Priority_Model_Processing &); + void operator= (const RT_Priority_Model_Processing &); + + enum State + { + NO_ACTION_REQUIRED, + PRIORITY_RESET_REQUIRED + }; + + // Indicates whether the priority of the thread needs to be reset + // back to its original value. + State state_; + + // Poa of the target servant. + TAO_POA &poa_; + + // Original priority of the thread. + RTCORBA::Priority original_priority_; +}; + +#include "ace/post.h" +#endif /* TAO_RT_SERVANT_DISPATCHER_H */ |