From 4f43509dbd78dda7460134a0889fd53d5df1331b Mon Sep 17 00:00:00 2001 From: irfan Date: Thu, 22 Jul 1999 00:12:01 +0000 Subject: ChangeLogTag:Wed Jul 21 18:38:00 1999 Irfan Pyarali --- ChangeLog-99b | 18 ++++++++++++++++++ ace/Cached_Connect_Strategy_T.cpp | 29 +++++++++++++++++++++++++++++ ace/Caching_Strategies_T.i | 5 ++--- ace/Hash_Cache_Map_Manager_T.cpp | 26 ++++++++++++++++++++++++++ ace/Hash_Cache_Map_Manager_T.i | 22 ++++------------------ ace/Strategies_T.cpp | 20 +++++++++++--------- ace/Strategies_T.h | 2 +- 7 files changed, 91 insertions(+), 31 deletions(-) diff --git a/ChangeLog-99b b/ChangeLog-99b index 978858a3ddc..3adf02c7e9a 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,21 @@ +Wed Jul 21 18:38:00 1999 Irfan Pyarali + + * ace/Strategies_T.h (ACE_Cached_Connect_Strategy): Renamed + to . + + * ace/Hash_Cache_Map_Manager_T.cpp (find): Finding and updating + the attributes is faster through the find() that uses an entry. + Therefore, for find (key, value) and find (key) we go to + find (key, entry) instead of going to the base class. + + * ace/Cached_Connect_Strategy_T.cpp: + + - ACE_Cached_Connect_Strategy_Ex::check_hint_i + - ACE_Cached_Connect_Strategy_Ex::find + + Update the caching attributes directly since we don't do a + find() on the cache map. + Wed Jul 21 15:54:25 1999 Nanbor Wang * ace/DLL.cpp: ACE_HAS_MOSTLY_UNICODE_APIS fixes. diff --git a/ace/Cached_Connect_Strategy_T.cpp b/ace/Cached_Connect_Strategy_T.cpp index 71b570e2723..925b003d23e 100644 --- a/ace/Cached_Connect_Strategy_T.cpp +++ b/ace/Cached_Connect_Strategy_T.cpp @@ -118,6 +118,20 @@ ACE_Cached_Connect_Strategy_Ex::check_hint_i // Tell the that it should prepare itself for // being recycled. this->prepare_for_recycling (sh); + + // + // Update the caching attributes directly since we don't do a + // find() on the cache map. + // + + // Indicates successful find. + int find_result = 0; + + int result = this->caching_strategy ().notify_find (find_result, + possible_entry->int_id_.second ()); + + if (result == -1) + return result; } else { @@ -450,6 +464,21 @@ ACE_Cached_Connect_Strategy_Ex::find (ACE_Refcounted_Hash_Recyclablecaching_strategy ().notify_find (find_result, + entry->int_id_.second ()); + + if (result == -1) + return result; + return 0; } diff --git a/ace/Caching_Strategies_T.i b/ace/Caching_Strategies_T.i index 2cfd63534aa..8a6e2493b9e 100644 --- a/ace/Caching_Strategies_T.i +++ b/ace/Caching_Strategies_T.i @@ -230,8 +230,6 @@ template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_find (int result, ATTRIBUTES &attr) { - ACE_UNUSED_ARG (attr); - if (result == 0) ++attr; @@ -255,6 +253,7 @@ ACE_LFU_Caching_Strategy::notify_rebind (int result return result; } + template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_unbind (int result, const ATTRIBUTES &attr) @@ -286,6 +285,7 @@ ACE_FIFO_Caching_Strategy::attributes (void) { return this->order_; } + template ACE_INLINE double ACE_FIFO_Caching_Strategy::purge_percent (void) { @@ -310,7 +310,6 @@ ACE_FIFO_Caching_Strategy::notify_bind (int result, return result; } - template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_find (int result, ATTRIBUTES &attr) diff --git a/ace/Hash_Cache_Map_Manager_T.cpp b/ace/Hash_Cache_Map_Manager_T.cpp index 57dde184a04..2e535816146 100644 --- a/ace/Hash_Cache_Map_Manager_T.cpp +++ b/ace/Hash_Cache_Map_Manager_T.cpp @@ -180,6 +180,32 @@ ACE_Hash_Cache_Map_Manager::find (const KEY &key, return find_result; } +template int +ACE_Hash_Cache_Map_Manager::find (const KEY &key, + VALUE &value) +{ + CACHE_ENTRY *entry = 0; + + int result = this->find (key, + entry); + + if (result != -1) + { + value = entry->int_id_.first (); + } + + return result; +} + +template int +ACE_Hash_Cache_Map_Manager::find (const KEY &key) +{ + CACHE_ENTRY *entry = 0; + + return this->find (key, + entry); +} + template int ACE_Hash_Cache_Map_Manager::unbind (ACE_Hash_Map_Entry > *entry) { diff --git a/ace/Hash_Cache_Map_Manager_T.i b/ace/Hash_Cache_Map_Manager_T.i index 0b1b691fd2c..f73e2d2aa7d 100644 --- a/ace/Hash_Cache_Map_Manager_T.i +++ b/ace/Hash_Cache_Map_Manager_T.i @@ -8,7 +8,7 @@ template ACE_INLINE int ACE_Hash_Cache_Map_Manager::bind (const KEY &key, const VALUE &value) { - return ACE_HCMM_BASE::bind (key, + return ACE_HCMM_BASE::bind (key, value); } @@ -16,8 +16,8 @@ template ACE_INLINE int ACE_Hash_Cache_Map_Manager::rebind (const KEY &key, const VALUE &value) { - return ACE_HCMM_BASE::rebind (key, - value); + return ACE_HCMM_BASE::rebind (key, + value); } template ACE_INLINE int @@ -25,7 +25,7 @@ ACE_Hash_Cache_Map_Manager::rebind (const KEY &key, const VALUE &value, VALUE &old_value) { - return ACE_HCMM_BASE::rebind (key, + return ACE_HCMM_BASE::rebind (key, value, old_value); } @@ -50,20 +50,6 @@ ACE_Hash_Cache_Map_Manager::trybind (const KEY &key, value); } -template ACE_INLINE int -ACE_Hash_Cache_Map_Manager::find (const KEY &key, - VALUE &value) -{ - return ACE_HCMM_BASE::find (key, - value); -} - -template ACE_INLINE int -ACE_Hash_Cache_Map_Manager::find (const KEY &key) -{ - return ACE_HCMM_BASE::find (key); -} - template ACE_INLINE int ACE_Hash_Cache_Map_Manager::unbind (const KEY &key) { diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index d449af737be..f435942e284 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -407,6 +407,8 @@ ACE_Cached_Connect_Strategy::~ACE_Cach if (this->delete_lock_) delete this->lock_; + delete this->reverse_lock_; + if (this->delete_creation_strategy_) delete this->creation_strategy_; this->delete_creation_strategy_ = 0; @@ -424,7 +426,7 @@ ACE_Cached_Connect_Strategy::~ACE_Cach // Close down all cached service handlers. CONNECTION_MAP_ENTRY *entry; - for (CONNECTION_MAP_ITERATOR iterator (connection_cache_); + for (CONNECTION_MAP_ITERATOR iterator (connection_map_); iterator.next (entry); iterator.advance ()) { @@ -626,7 +628,7 @@ ACE_Cached_Connect_Strategy::find_or_c else { // Insert the new SVC_HANDLER instance into the cache. - if (this->connection_cache_.bind (search_addr, + if (this->connection_map_.bind (search_addr, sh, entry) == -1) return -1; @@ -924,7 +926,7 @@ ACE_Cached_Connect_Strategy::purge_i ( // The wonders and perils of ACT CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act; - return this->connection_cache_.unbind (entry); + return this->connection_map_.unbind (entry); } template int @@ -1008,14 +1010,14 @@ ACE_Cached_Connect_Strategy::find (ACE ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> - CONNECTION_CACHE_BUCKET_ITERATOR; + CONNECTION_MAP_BUCKET_ITERATOR; - CONNECTION_CACHE_BUCKET_ITERATOR iterator (this->connection_cache_, - search_addr); + CONNECTION_MAP_BUCKET_ITERATOR iterator (this->connection_map_, + search_addr); - CONNECTION_CACHE_BUCKET_ITERATOR end (this->connection_cache_, - search_addr, - 1); + CONNECTION_MAP_BUCKET_ITERATOR end (this->connection_map_, + search_addr, + 1); for (; iterator != end; diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h index fadd7d517f3..ab700219755 100644 --- a/ace/Strategies_T.h +++ b/ace/Strategies_T.h @@ -851,7 +851,7 @@ protected: int perms, int &found); - CONNECTION_MAP connection_cache_; + CONNECTION_MAP connection_map_; // Table that maintains the cache of connected s. MUTEX *lock_; -- cgit v1.2.1