diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2007-08-14 16:21:42 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2007-08-14 16:21:42 +0000 |
commit | f651a55538c22a3558715718dd56d770ed02f8ac (patch) | |
tree | fee18f4b20924e50081ee083925b20f88e157cf7 | |
parent | 9caa4231f1091decf62eec4bee620524c4d2ecc8 (diff) | |
download | ATCD-f651a55538c22a3558715718dd56d770ed02f8ac.tar.gz |
Tue Aug 14 16:19:35 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 16 | ||||
-rw-r--r-- | TAO/tao/Cache_Entries.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Cache_Entries.h | 7 | ||||
-rw-r--r-- | TAO/tao/Cache_Entries.inl | 6 | ||||
-rw-r--r-- | TAO/tao/Transport.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/Transport.inl | 3 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.h | 3 | ||||
-rw-r--r-- | TAO/tao/Transport_Cache_Manager.inl | 12 |
9 files changed, 65 insertions, 7 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index a9a691bc4b0..d269c8489e7 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Tue Aug 14 16:19:35 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com> + + * tao/Cache_Entries.h: + * tao/Cache_Entries.inl: + * tao/Cache_Entries.cpp: + * tao/Transport.inl: + * tao/Transport.cpp: + * tao/Transport_Cache_Manager.h: + * tao/Transport_Cache_Manager.inl: + * tao/Transport_Cache_Manager.cpp: + + Performance enhancement for looking up connections in the + cache. The problem was that the fix for the transport cache + problems required a call to Transport->is_connected(), which has + a lock. + Tue Aug 14 10:25:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> * tao/Transport_Selection_Guard.cpp: diff --git a/TAO/tao/Cache_Entries.cpp b/TAO/tao/Cache_Entries.cpp index 99ecb2ad72b..1c89cadb931 100644 --- a/TAO/tao/Cache_Entries.cpp +++ b/TAO/tao/Cache_Entries.cpp @@ -20,7 +20,9 @@ namespace TAO Cache_IntId::Cache_IntId (TAO_Transport *transport) : transport_ (transport) , recycle_state_ (ENTRY_UNKNOWN) + , is_connected_ (false) { + this->is_connected_ = transport->is_connected(); transport->add_reference (); } @@ -36,7 +38,7 @@ namespace TAO if (this != &rhs) { this->recycle_state_ = rhs.recycle_state_; - + this->is_connected_ = rhs.is_connected_; TAO_Transport *old_transport = this->transport_; this->transport_ = rhs.transport_; if (this->transport_) diff --git a/TAO/tao/Cache_Entries.h b/TAO/tao/Cache_Entries.h index 3522ef8e92c..77ebe7e243c 100644 --- a/TAO/tao/Cache_Entries.h +++ b/TAO/tao/Cache_Entries.h @@ -33,6 +33,7 @@ class TAO_Transport; namespace TAO { + class Transport_Cache_Manager; /// States of a recyclable object. /// @todo: see discussion in bugzilla 3024 enum Cache_Entries_State @@ -72,7 +73,7 @@ namespace TAO class TAO_Export Cache_IntId { public: - + friend class TAO::Transport_Cache_Manager; /// Constructor. Cache_IntId (void); @@ -123,6 +124,10 @@ namespace TAO /// The state of the handle Cache_Entries_State recycle_state_; + + /// This is an analog for the transport::is_connected(), which is + /// guarded by a mutex. + bool is_connected_; }; diff --git a/TAO/tao/Cache_Entries.inl b/TAO/tao/Cache_Entries.inl index 41d04e882aa..779fa355bef 100644 --- a/TAO/tao/Cache_Entries.inl +++ b/TAO/tao/Cache_Entries.inl @@ -9,14 +9,16 @@ namespace TAO ACE_INLINE Cache_IntId::Cache_IntId (void) : transport_ (0), - recycle_state_ (ENTRY_UNKNOWN) + recycle_state_ (ENTRY_UNKNOWN), + is_connected_ (false) { } ACE_INLINE Cache_IntId::Cache_IntId (const Cache_IntId &rhs) : transport_ (0), - recycle_state_ (ENTRY_UNKNOWN) + recycle_state_ (ENTRY_UNKNOWN), + is_connected_ (false) { *this = rhs; } diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index 5dc78759a89..602af8333ed 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -308,7 +308,7 @@ TAO_Transport::post_connect_hook (void) bool TAO_Transport::register_if_necessary (void) { - if (this->is_connected () && + if (this->is_connected_ && ! this->wait_strategy ()->is_registered () && this->wait_strategy ()->register_handler () != 0) { @@ -2525,7 +2525,14 @@ TAO_Transport::out_stream (void) void TAO_Transport::pre_close (void) { + // @TODO: something needs to be done with is_connected_. Checking it is + // guarded by a mutex, but setting it is not. Until the need for mutexed + // protection is required, the transport cache is holding its own copy + // of the is_connected_ flag, so that during cache lookups the cache + // manager doesn't need to be burdened by the lock in is_connected(). this->is_connected_ = false; + this->transport_cache_manager().mark_connected(this->cache_map_entry_, + false); this->purge_entry (); { ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->handler_lock_)); @@ -2567,7 +2574,15 @@ TAO_Transport::post_open (size_t id) } } + // @TODO: something needs to be done with is_connected_. Checking it is + // guarded by a mutex, but setting it is not. Until the need for mutexed + // protection is required, the transport cache is holding its own copy + // of the is_connected_ flag, so that during cache lookups the cache + // manager doesn't need to be burdened by the lock in is_connected(). this->is_connected_ = true; + this->transport_cache_manager ().mark_connected (this->cache_map_entry_, + true); + // update transport cache to make this entry available this->transport_cache_manager ().set_entry_state ( this->cache_map_entry_, diff --git a/TAO/tao/Transport.inl b/TAO/tao/Transport.inl index ecaf930dbbc..983913d9bf2 100644 --- a/TAO/tao/Transport.inl +++ b/TAO/tao/Transport.inl @@ -163,6 +163,9 @@ TAO_Transport::first_request_sent (void) ACE_INLINE bool TAO_Transport::is_connected (void) const { + // @TODO: this flag does not seem to be protecting anything. + // The state of is_connected_ is modified without the guard + // in Transport.cpp. ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp index e19593d4cdd..e994b083a3b 100644 --- a/TAO/tao/Transport_Cache_Manager.cpp +++ b/TAO/tao/Transport_Cache_Manager.cpp @@ -425,7 +425,7 @@ namespace TAO if (result && entry.int_id_.transport () != 0) { // if it's not connected, it's not available - result = entry.int_id_.transport ()->is_connected(); + result = entry.int_id_.is_connected_; } if (TAO_debug_level > 8) @@ -450,7 +450,7 @@ namespace TAO { // if we're not connected, that counts, too. // Can this happen? Not sure <wilsond@ociweb.com> - result = !entry.int_id_.transport ()->is_connected(); + result = !entry.int_id_.is_connected_; } if (TAO_debug_level > 8) diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h index 8466ef4f236..f4734b32054 100644 --- a/TAO/tao/Transport_Cache_Manager.h +++ b/TAO/tao/Transport_Cache_Manager.h @@ -127,6 +127,9 @@ namespace TAO /// Mark the entry as invalid for use but keep it in cache. void mark_invalid (HASH_MAP_ENTRY * entry); + /// Mark the entry as connected. + void mark_connected (HASH_MAP_ENTRY * entry, bool state); + /// Make the entry idle and ready for use. int make_idle (HASH_MAP_ENTRY *entry); diff --git a/TAO/tao/Transport_Cache_Manager.inl b/TAO/tao/Transport_Cache_Manager.inl index 68ffeb47eaf..e5f3f1c1709 100644 --- a/TAO/tao/Transport_Cache_Manager.inl +++ b/TAO/tao/Transport_Cache_Manager.inl @@ -77,6 +77,18 @@ namespace TAO this->mark_invalid_i (entry); } + ACE_INLINE void + Transport_Cache_Manager::mark_connected (HASH_MAP_ENTRY *entry, + bool state) + { + if(entry == 0) + return; + + // ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->cache_lock_)); + + entry->item().is_connected_ = state; + } + ACE_INLINE int Transport_Cache_Manager::make_idle (HASH_MAP_ENTRY *entry) { |