diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-27 01:38:51 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-27 01:38:51 +0000 |
commit | 3d1b274ac51dd96c6644aa56bbd70a0a5fe861c0 (patch) | |
tree | 93904b4aa5848b8bcd58958e81ecbb4223da2f22 | |
parent | c2adf9b6ff6c49972f7d45708220c52d4810af40 (diff) | |
download | ATCD-3d1b274ac51dd96c6644aa56bbd70a0a5fe861c0.tar.gz |
ChangeLogTag:Thu Aug 26 20:34:54 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 25 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/IIOP_Acceptor.h | 41 | ||||
-rw-r--r-- | TAO/tao/Pluggable.cpp | 57 | ||||
-rw-r--r-- | TAO/tao/Pluggable.h | 34 | ||||
-rw-r--r-- | TAO/tao/Pluggable.i | 62 | ||||
-rw-r--r-- | TAO/tao/Tagged_Components.cpp | 28 | ||||
-rw-r--r-- | TAO/tao/Tagged_Components.h | 21 | ||||
-rw-r--r-- | TAO/tao/Tagged_Components.i | 19 | ||||
-rw-r--r-- | TAO/tao/UIOP_Acceptor.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/UIOP_Acceptor.h | 41 | ||||
-rw-r--r-- | TAO/tao/corbafwd.h | 8 |
12 files changed, 185 insertions, 165 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index 3a0154284c0..f00712080e9 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,28 @@ +Thu Aug 26 20:34:54 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/Pluggable.h: + * tao/Pluggable.i: + * tao/Pluggable.cpp: + Added new <priority> field to the Acceptors, this is used to + setup a TAO-specific tagged component that informs the client + about the priority of the threads handling events on that + endpoint. + Also moved lightweight methods to the .i file, they were not + virtual and used in a couple of places in the critical path. + + * tao/corbafwd.h: + * tao/Tagged_Components.h: + * tao/Tagged_Components.i: + * tao/Tagged_Components.cpp: + Changed the TAO_TAG_PRIORITY component to have simply a + priority, not a range. + + * tao/IIOP_Acceptor.h: + * tao/IIOP_Acceptor.cpp: + * tao/UIOP_Acceptor.h: + * tao/UIOP_Acceptor.cpp: + Implemented the priority stuff for the concrete protocols. + Thu Aug 26 17:37:01 1999 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/include/ast_interface.h: diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index b239832aec3..8a07f99b363 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -92,6 +92,8 @@ TAO_IIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, code_set_info.ForWcharData.native_code_set = TAO_DEFAULT_WCHAR_CODESET_ID; pfile->tagged_components ().set_code_sets (code_set_info); + pfile->tagged_components ().set_tao_priority (this->priority ()); + return 0; } @@ -121,8 +123,11 @@ int TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, int major, int minor, - ACE_CString &address) + ACE_CString &address, + CORBA::Short corba_priority) { + this->priority_ = corba_priority; + if (major >=0 && minor >= 0) this->version_.set_version (ACE_static_cast (CORBA::Octet,major), ACE_static_cast (CORBA::Octet,minor)); diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index c45e93d7fbd..83b5fc2150a 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -49,32 +49,6 @@ public: ~TAO_IIOP_Acceptor (void); // Destructor. - virtual int open (TAO_ORB_Core *orb_core, - int version_major, - int version_minor, - ACE_CString &address); - // initialize acceptor for this address. - - virtual int open_default (TAO_ORB_Core *orb_core); - // Open an acceptor on the default endpoint for this protocol - - int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); - // create profile objects for this Acceptor using the SAP - // (service access point, Host and Port) and object_key. - - // = See TAO_Acceptor - virtual int is_collocated (const TAO_Profile*); - - ACE_Event_Handler *acceptor (void); - // Return the underlying acceptor object, ACE_Acceptor - - virtual int close (void); - // Closes the acceptor - - CORBA::ULong endpoint_count (void); - // return the number of profiles this will generate - const ACE_INET_Addr& address (void) const; // @@ Helper method for the implementation repository, should go // away @@ -84,6 +58,21 @@ public: typedef TAO_Concurrency_Strategy<TAO_IIOP_Server_Connection_Handler> TAO_IIOP_CONCURRENCY_STRATEGY; typedef TAO_Accept_Strategy<TAO_IIOP_Server_Connection_Handler, ACE_SOCK_ACCEPTOR> TAO_IIOP_ACCEPT_STRATEGY; + // = The TAO_Acceptor methods, check the documentation in + // Pluggable.h for details. + virtual int open (TAO_ORB_Core *orb_core, + int version_major, + int version_minor, + ACE_CString &address, + CORBA::Short corba_priority = 0); + virtual int open_default (TAO_ORB_Core *orb_core); + virtual int close (void); + virtual int create_mprofile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile); + virtual ACE_Event_Handler *acceptor (void); + virtual int is_collocated (const TAO_Profile* profile); + virtual CORBA::ULong endpoint_count (void); + private: int open_i (TAO_ORB_Core* orb_core, const ACE_INET_Addr& addr); diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp index 5a2993c8bcc..300895c6d5d 100644 --- a/TAO/tao/Pluggable.cpp +++ b/TAO/tao/Pluggable.cpp @@ -26,42 +26,6 @@ ACE_RCSID(tao, Pluggable, "$Id$") TAO_Profile::~TAO_Profile (void) { } - -// Generic Profile -CORBA::ULong -TAO_Profile::tag (void) const -{ - return this->tag_; -} - -CORBA::ULong -TAO_Profile::_incr_refcnt (void) -{ - // OK, think I got it. When this object is created (guard) the - // lock is automatically acquired (refcount_lock_). Then when - // we leave this method the destructir for guard is called which - // releases the lock! - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->refcount_lock_, 0); - - return this->refcount_++; -} - -CORBA::ULong -TAO_Profile::_decr_refcnt (void) -{ - { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->refcount_lock_, 0); - this->refcount_--; - if (this->refcount_ != 0) - return this->refcount_; - } - - // refcount is 0, so delete us! - // delete will call our ~ destructor which in turn deletes stuff. - delete this; - return 0; -} - // **************************************************************** TAO_Unknown_Profile::TAO_Unknown_Profile (CORBA::ULong tag) @@ -172,12 +136,6 @@ TAO_Transport::~TAO_Transport (void) this->tms_ =0; } -CORBA::ULong -TAO_Transport::tag (void) const -{ - return this->tag_; -} - // Read and handle the reply. Returns 0 when there is Short Read on // the connection. Returns 1 when the full reply is read and // handled. Returns -1 on errors. @@ -257,12 +215,6 @@ TAO_Connector::~TAO_Connector (void) { } -CORBA::ULong -TAO_Connector::tag (void) const -{ - return this->tag_; -} - int TAO_Connector::make_mprofile (const char *string, TAO_MProfile &mprofile, @@ -436,16 +388,11 @@ TAO_Connector::make_mprofile (const char *string, // Acceptor TAO_Acceptor::TAO_Acceptor (CORBA::ULong tag) - : tag_ (tag) + : priority_ (0), + tag_ (tag) { } TAO_Acceptor::~TAO_Acceptor (void) { } - -CORBA::ULong -TAO_Acceptor::tag (void) const -{ - return this->tag_; -} diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h index 93154ad965f..aab7ae374e5 100644 --- a/TAO/tao/Pluggable.h +++ b/TAO/tao/Pluggable.h @@ -354,45 +354,53 @@ class TAO_Export TAO_Acceptor // = DESCRIPTION // Base class for the Acceptor bridge calss. public: - TAO_Acceptor (CORBA::ULong tag); - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) = 0; - // Create the corresponding profile for this endpoint. + virtual ~TAO_Acceptor (void); + // Destructor + + CORBA::ULong tag (void) const; + // The tag, each concrete class will have a specific tag value. + + CORBA::Short priority (void) const; + // The priority for this endpoint. virtual int open (TAO_ORB_Core *orb_core, int version_major, int version_minor, - ACE_CString &address) = 0; + ACE_CString &address, + CORBA::Short corba_priority = 0) = 0; // method to initialize acceptor for address. virtual int open_default (TAO_ORB_Core *orb_core) = 0; // Open an acceptor on the default endpoint for this protocol + virtual int close (void) = 0; + // Closes the acceptor + + virtual int create_mprofile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile) = 0; + // Create the corresponding profile for this endpoint. + virtual ACE_Event_Handler *acceptor (void) = 0; // Return the ACE acceptor... virtual int is_collocated (const TAO_Profile* profile) = 0; // Return 1 if the <profile> has the same endpoint as the acceptor. - CORBA::ULong tag (void) const; - // The tag, each concrete class will have a specific tag value. - - virtual int close (void) = 0; - // Closes the acceptor - virtual CORBA::ULong endpoint_count (void) = 0; // returns the number of endpoints this acceptor is listening on. This // is used for determining how many profiles will be generated // for this acceptor. - virtual ~TAO_Acceptor (void); - // Destructor +protected: + CORBA::Short priority_; + // The priority for this endpoint private: CORBA::ULong tag_; // IOP protocol tag. + }; class TAO_Export TAO_Connector diff --git a/TAO/tao/Pluggable.i b/TAO/tao/Pluggable.i index e3cab2239ef..2cf99c90146 100644 --- a/TAO/tao/Pluggable.i +++ b/TAO/tao/Pluggable.i @@ -22,6 +22,12 @@ TAO_Transport::wait_strategy (void) const return this->ws_; } +ACE_INLINE CORBA::ULong +TAO_Transport::tag (void) const +{ + return this->tag_; +} + // **************************************************************** ACE_INLINE @@ -32,6 +38,40 @@ TAO_Profile::TAO_Profile (CORBA::ULong tag) { } +ACE_INLINE CORBA::ULong +TAO_Profile::tag (void) const +{ + return this->tag_; +} + +ACE_INLINE CORBA::ULong +TAO_Profile::_incr_refcnt (void) +{ + // OK, think I got it. When this object is created (guard) the + // lock is automatically acquired (refcount_lock_). Then when + // we leave this method the destructir for guard is called which + // releases the lock! + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->refcount_lock_, 0); + + return this->refcount_++; +} + +ACE_INLINE CORBA::ULong +TAO_Profile::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->refcount_lock_, 0); + this->refcount_--; + if (this->refcount_ != 0) + return this->refcount_; + } + + // refcount is 0, so delete us! + // delete will call our ~ destructor which in turn deletes stuff. + delete this; + return 0; +} + ACE_INLINE void TAO_Profile::forward_to (TAO_MProfile *mprofiles) { @@ -49,3 +89,25 @@ TAO_Profile::forward_to_i (void) { return this->forward_to_; } + +// **************************************************************** + +ACE_INLINE CORBA::ULong +TAO_Connector::tag (void) const +{ + return this->tag_; +} + +// **************************************************************** + +ACE_INLINE CORBA::ULong +TAO_Acceptor::tag (void) const +{ + return this->tag_; +} + +ACE_INLINE CORBA::Short +TAO_Acceptor::priority (void) const +{ + return this->priority_; +} diff --git a/TAO/tao/Tagged_Components.cpp b/TAO/tao/Tagged_Components.cpp index 64b8114eaa1..5ff6c356e06 100644 --- a/TAO/tao/Tagged_Components.cpp +++ b/TAO/tao/Tagged_Components.cpp @@ -65,21 +65,18 @@ TAO_Tagged_Components::set_code_sets_i ( } void -TAO_Tagged_Components::set_tao_priority_range (CORBA::Short min_p, - CORBA::Short max_p) +TAO_Tagged_Components::set_tao_priority (CORBA::Short p) { - this->tao_priority_min_ = min_p; - this->tao_priority_max_ = max_p; - this->tao_priority_range_set_ = 1; + this->tao_priority_ = p; + this->tao_priority_set_ = 1; TAO_OutputCDR cdr; cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); cdr << this->orb_type_; - cdr << this->tao_priority_min_; - cdr << this->tao_priority_max_; + cdr << this->tao_priority_; - this->set_component_i (TAO_TAG_PRIORITY_RANGE, cdr); + this->set_component_i (TAO_TAG_PRIORITY, cdr); } // **************************************************************** @@ -162,18 +159,15 @@ TAO_Tagged_Components::set_known_component_i ( ci.ForWcharData); this->code_sets_set_ = 1; } - else if (component.tag == TAO_TAG_PRIORITY_RANGE) + else if (component.tag == TAO_TAG_PRIORITY) { - CORBA::Short min_p, max_p; + CORBA::Short p; - if ((cdr >> min_p) != 0 - || (cdr >> max_p) != 0 - || min_p > max_p) + if ((cdr >> p) != 0) return; - this->tao_priority_min_ = min_p; - this->tao_priority_max_ = max_p; - this->tao_priority_range_set_ = 1; + this->tao_priority_ = p; + this->tao_priority_set_ = 1; } } @@ -262,7 +256,7 @@ TAO_Tagged_Components::decode (TAO_InputCDR& cdr) // Mark the well-known components as removed this->orb_type_set_ = 0; this->code_sets_set_ = 0; - this->tao_priority_range_set_ = 0; + this->tao_priority_set_ = 0; if ((cdr >> this->components_) == 0) return 0; diff --git a/TAO/tao/Tagged_Components.h b/TAO/tao/Tagged_Components.h index b3517be0db2..7439943316f 100644 --- a/TAO/tao/Tagged_Components.h +++ b/TAO/tao/Tagged_Components.h @@ -74,13 +74,11 @@ public: // if the component is not present. // = TAO specific components - void set_tao_priority_range (CORBA::Short min_priority, - CORBA::Short max_priority); - // The the TAO_TAG_PRIORITY_RANGE component value. + void set_tao_priority (CORBA::Short priority); + // The the TAO_TAG_PRIORITY component value. - int get_tao_priority_range (CORBA::Short& min_priority, - CORBA::Short& max_priority) const; - // Gets the TAO_TAG_PRIORITY_RANGE component value. + int get_tao_priority (CORBA::Short& min_priority) const; + // Gets the TAO_TAG_PRIORITY component value. // = Generic components @@ -132,18 +130,17 @@ private: CONV_FRAME::CodeSetComponentInfo code_sets_; // The ORB_TYPE component value - CORBA::Short tao_priority_min_; - CORBA::Short tao_priority_max_; - // The TAO_PRIORITY_RANGE priorities + CORBA::Short tao_priority_; + // The TAO_PRIORITY priorities IOP::MultipleComponentProfile components_; // The rest of the components, to be compliant we cannot drop a // bunch of them. // A flag for each component... - unsigned int orb_type_set_ : 1; - unsigned int code_sets_set_ : 1; - unsigned int tao_priority_range_set_ : 1; + CORBA::Octet orb_type_set_; + CORBA::Octet code_sets_set_; + CORBA::Octet tao_priority_set_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/tao/Tagged_Components.i b/TAO/tao/Tagged_Components.i index d876667d609..6f5f7e6d95b 100644 --- a/TAO/tao/Tagged_Components.i +++ b/TAO/tao/Tagged_Components.i @@ -3,11 +3,10 @@ ACE_INLINE TAO_Tagged_Components::TAO_Tagged_Components (void) : orb_type_ (0), - tao_priority_min_ (0), - tao_priority_max_ (0), + tao_priority_ (0), orb_type_set_ (0), code_sets_set_ (0), - tao_priority_range_set_ (0) + tao_priority_set_ (0) { } @@ -20,15 +19,13 @@ TAO_Tagged_Components::get_orb_type (CORBA::ULong& orb_type) const } ACE_INLINE int -TAO_Tagged_Components::get_tao_priority_range (CORBA::Short& min_p, - CORBA::Short& max_p) const +TAO_Tagged_Components::get_tao_priority (CORBA::Short& p) const { - if (this->tao_priority_range_set_ == 1) + if (this->tao_priority_set_ == 1) { - min_p = this->tao_priority_min_; - max_p = this->tao_priority_max_; + p = this->tao_priority_; } - return this->tao_priority_range_set_; + return this->tao_priority_set_; } ACE_INLINE int @@ -52,7 +49,7 @@ TAO_Tagged_Components::known_tag (IOP::ComponentId tag) const { return (tag == IOP::TAG_ORB_TYPE || tag == IOP::TAG_CODE_SETS - || tag == TAO_TAG_PRIORITY_RANGE); + || tag == TAO_TAG_PRIORITY); } ACE_INLINE int @@ -60,7 +57,7 @@ TAO_Tagged_Components::unique_tag (IOP::ComponentId tag) const { return (tag == IOP::TAG_ORB_TYPE || tag == IOP::TAG_CODE_SETS - || tag == TAO_TAG_PRIORITY_RANGE + || tag == TAO_TAG_PRIORITY || tag == IOP::TAG_POLICIES // || tag == IOP::TAG_ALTERNATE_IIOP_ADDRESS || tag == IOP::TAG_ASSOCIATION_OPTIONS diff --git a/TAO/tao/UIOP_Acceptor.cpp b/TAO/tao/UIOP_Acceptor.cpp index 937a21aeb70..d51ac71372f 100644 --- a/TAO/tao/UIOP_Acceptor.cpp +++ b/TAO/tao/UIOP_Acceptor.cpp @@ -94,6 +94,8 @@ TAO_UIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, code_set_info.ForWcharData.native_code_set = TAO_DEFAULT_WCHAR_CODESET_ID; pfile->tagged_components ().set_code_sets (code_set_info); + pfile->tagged_components ().set_tao_priority (this->priority ()); + return 0; } @@ -135,8 +137,11 @@ int TAO_UIOP_Acceptor::open (TAO_ORB_Core *orb_core, int major, int minor, - ACE_CString &address) + ACE_CString &address, + CORBA::Short corba_priority) { + this->priority_ = corba_priority; + if (major >= 0 && minor >= 0) this->version_.set_version (ACE_static_cast (CORBA::Octet, major), ACE_static_cast (CORBA::Octet, minor)); diff --git a/TAO/tao/UIOP_Acceptor.h b/TAO/tao/UIOP_Acceptor.h index 4945fe40e41..094783103d1 100644 --- a/TAO/tao/UIOP_Acceptor.h +++ b/TAO/tao/UIOP_Acceptor.h @@ -53,37 +53,26 @@ public: virtual ~TAO_UIOP_Acceptor (void); // Destructor - int open (TAO_ORB_Core *orb_core, - int version_major, - int version_minor, - ACE_CString &address); - // initialize acceptor for this address. - - virtual int close (void); - // Closes the acceptor - - virtual int open_default (TAO_ORB_Core *orb_core); - // Open an acceptor on the default endpoint for this protocol - - int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); - // create profile objects for this Acceptor using the SAP - // (service access point) and object_key. - - // = See TAO_Acceptor - virtual int is_collocated (const TAO_Profile*); - - virtual ACE_Event_Handler *acceptor (void); - // Return the underlying acceptor object, ACE_Acceptor - - CORBA::ULong endpoint_count (void); - // return the number of profiles this will generate - typedef ACE_Strategy_Acceptor<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR> TAO_UIOP_BASE_ACCEPTOR; typedef TAO_Creation_Strategy<TAO_UIOP_Server_Connection_Handler> TAO_UIOP_CREATION_STRATEGY; typedef TAO_Concurrency_Strategy<TAO_UIOP_Server_Connection_Handler> TAO_UIOP_CONCURRENCY_STRATEGY; typedef TAO_Accept_Strategy<TAO_UIOP_Server_Connection_Handler, ACE_LSOCK_ACCEPTOR> TAO_UIOP_ACCEPT_STRATEGY; + // = The TAO_Acceptor methods, check the documentation in + // Pluggable.h for details. + virtual int open (TAO_ORB_Core *orb_core, + int version_major, + int version_minor, + ACE_CString &address, + CORBA::Short corba_priority = 0); + virtual int open_default (TAO_ORB_Core *orb_core); + virtual int close (void); + virtual int create_mprofile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile); + virtual ACE_Event_Handler *acceptor (void); + virtual int is_collocated (const TAO_Profile* profile); + virtual CORBA::ULong endpoint_count (void); + private: int open_i (TAO_ORB_Core *orb_core, const char *rendezvous); // Implement the common part of the open*() methods diff --git a/TAO/tao/corbafwd.h b/TAO/tao/corbafwd.h index b080d1c6b90..b6dfa03db53 100644 --- a/TAO/tao/corbafwd.h +++ b/TAO/tao/corbafwd.h @@ -1673,9 +1673,11 @@ TAO_NAMESPACE_CLOSE // end of class (namespace) CORBA // We reserved the range 0x54414f00 - 0x54414f0f with the OMG to // define our own profile tagged components in TAO. -// Store the priority range in the *server* so the client can choose -// the right endpoint -#define TAO_TAG_PRIORITY_RANGE 0x54414f00U +// Store the priority of the thread (pool) that services this +// endpoint, using that information the client can select the right +// endpoint providing very low priority inversion (basically only in +// the I/O subsystem). +#define TAO_TAG_PRIORITY 0x54414f00U // #define TAO_TAG_ANOTHER_COMPONENT 0x54414f01U // We reserved the range 0x54414f00 - 0x54414f0f with the OMG to |