diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-22 00:12:01 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-22 00:12:01 +0000 |
commit | 4f43509dbd78dda7460134a0889fd53d5df1331b (patch) | |
tree | 6b3aa18660129648f41cfff661203b02956a2699 | |
parent | 55872972d6fb913a92846b954a4b45ea162aa6d1 (diff) | |
download | ATCD-4f43509dbd78dda7460134a0889fd53d5df1331b.tar.gz |
ChangeLogTag:Wed Jul 21 18:38:00 1999 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | ChangeLog-99b | 18 | ||||
-rw-r--r-- | ace/Cached_Connect_Strategy_T.cpp | 29 | ||||
-rw-r--r-- | ace/Caching_Strategies_T.i | 5 | ||||
-rw-r--r-- | ace/Hash_Cache_Map_Manager_T.cpp | 26 | ||||
-rw-r--r-- | ace/Hash_Cache_Map_Manager_T.i | 22 | ||||
-rw-r--r-- | ace/Strategies_T.cpp | 20 | ||||
-rw-r--r-- | 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 <irfan@cs.wustl.edu> + + * ace/Strategies_T.h (ACE_Cached_Connect_Strategy): Renamed + <connection_cache_> to <connection_map_>. + + * 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 <nanbor@cs.wustl.edu> * 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<ACE_T2>::check_hint_i // Tell the <svc_handler> 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<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE continue; entry = &(*iterator); + + // + // 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, + 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<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result, ATTRIBUTES &attr) { - ACE_UNUSED_ARG (attr); - if (result == 0) ++attr; @@ -255,6 +253,7 @@ ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result return result; } + template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result, const ATTRIBUTES &attr) @@ -286,6 +285,7 @@ ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void) { return this->order_; } + template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void) { @@ -310,7 +310,6 @@ ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result, return result; } - template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::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 @@ -181,6 +181,32 @@ ACE_Hash_Cache_Map_Manager<T_2>::find (const KEY &key, } template <T_1> int +ACE_Hash_Cache_Map_Manager<T_2>::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 <T_1> int +ACE_Hash_Cache_Map_Manager<T_2>::find (const KEY &key) +{ + CACHE_ENTRY *entry = 0; + + return this->find (key, + entry); +} + +template <T_1> int ACE_Hash_Cache_Map_Manager<T_2>::unbind (ACE_Hash_Map_Entry<KEY, ACE_Pair<VALUE, ATTRIBUTES> > *entry) { // Remove the entry from the cache. 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 <T_1> ACE_INLINE int ACE_Hash_Cache_Map_Manager<T_2>::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 <T_1> ACE_INLINE int ACE_Hash_Cache_Map_Manager<T_2>::rebind (const KEY &key, const VALUE &value) { - return ACE_HCMM_BASE::rebind (key, - value); + return ACE_HCMM_BASE::rebind (key, + value); } template <T_1> ACE_INLINE int @@ -25,7 +25,7 @@ ACE_Hash_Cache_Map_Manager<T_2>::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); } @@ -51,20 +51,6 @@ ACE_Hash_Cache_Map_Manager<T_2>::trybind (const KEY &key, } template <T_1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<T_2>::find (const KEY &key, - VALUE &value) -{ - return ACE_HCMM_BASE::find (key, - value); -} - -template <T_1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<T_2>::find (const KEY &key) -{ - return ACE_HCMM_BASE::find (key); -} - -template <T_1> ACE_INLINE int ACE_Hash_Cache_Map_Manager<T_2>::unbind (const KEY &key) { return ACE_HCMM_BASE::unbind (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<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::~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<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::~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<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::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<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::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<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int @@ -1008,14 +1010,14 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::find (ACE ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, 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 <SVC_HANDLER>s. MUTEX *lock_; |