From 03a868fdbd771619d5e374a3163d4517c5163f60 Mon Sep 17 00:00:00 2001 From: irfan Date: Mon, 21 Sep 1998 07:28:45 +0000 Subject: *** empty log message *** --- ace/Strategies_T.h | 130 ++++++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 60 deletions(-) (limited to 'ace/Strategies_T.h') diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h index 5c17c90f112..b5514295ea5 100644 --- a/ace/Strategies_T.h +++ b/ace/Strategies_T.h @@ -686,59 +686,6 @@ public: // This is a no-op. }; -template -class ACE_Recyclable -{ -public: - - // = Initialization methods. - ACE_Recyclable (void); - // Default constructor. - - ACE_Recyclable (const T &t, int recyclable = 0); - // Constructor. - - ~ACE_Recyclable (void); - // Destructor. - - int operator== (const ACE_Recyclable &rhs) const; - // Compares two values. - - // = Set/Get the recyclable bit - int recyclable (void) const; - void recyclable (int new_value); - -protected: - int recyclable_; - // We need to know if the is "in-use". If it is, we can - // operator==() can skip the comparison. - - T t_; - // The underlying class. -}; - -template -class ACE_Hash_Recyclable : public ACE_Recyclable -{ -public: - - // = Initialization methods. - ACE_Hash_Recyclable (void); - // Default constructor. - - ACE_Hash_Recyclable (const T &t, int recyclable = 0); - // Constructor. - - ~ACE_Hash_Recyclable (void); - // Destructor. - - u_long hash (void) const; - // Computes and returns hash value. - - int operator== (const ACE_Recyclable &rhs) const; - // Compares two values. -}; - template class ACE_Hash_Addr { @@ -780,6 +727,33 @@ private: // The underlying address. }; +template +class ACE_Refcounted_Hash_Recyclable : public ACE_Refcountable, + public ACE_Hashable, + public ACE_Recyclable +{ +public: + ACE_Refcounted_Hash_Recyclable (void); + // Default constructor. + + ACE_Refcounted_Hash_Recyclable (const T &t, + int refcount = 0, + ACE_Recyclable::State state = ACE_Recyclable::UNKNOWN); + // Constructor. + + virtual ~ACE_Refcounted_Hash_Recyclable (void); + // Destructor + + u_long hash (void) const; + // Computes and returns hash value. + + int operator== (const ACE_Refcounted_Hash_Recyclable &rhs) const; + // Compares two instances. + +protected: + T t_; +}; + template class ACE_Cached_Connect_Strategy : public ACE_Connection_Recycling_Strategy, public ACE_Connect_Strategy { @@ -868,7 +842,12 @@ public: virtual int cache (const void *recycling_act); // Add to cache. -private: + virtual int mark_as_closed (const void *recycling_act); + // Mark as closed. + + virtual int cleanup_hint (const void *recycling_act); + // Cleanup hint. + // = Define some useful typedefs. typedef ACE_Creation_Strategy CREATION_STRATEGY; @@ -883,16 +862,47 @@ private: // = Typedefs for managing the map typedef ACE_Hash_Addr - ADDRESS; - typedef ACE_Hash_Recyclable
- RECYCLABLE_ADDRESS; - typedef ACE_Hash_Map_Manager + HASH_ADDRESS; + typedef ACE_Refcounted_Hash_Recyclable + REFCOUNTED_HASH_RECYCLABLE_ADDRESS; + typedef ACE_Hash_Map_Manager CONNECTION_MAP; - typedef ACE_Hash_Map_Iterator + typedef ACE_Hash_Map_Iterator CONNECTION_MAP_ITERATOR; - typedef ACE_Hash_Map_Entry + typedef ACE_Hash_Map_Entry CONNECTION_MAP_ENTRY; +protected: + + virtual int purge_i (const void *recycling_act); + // Remove from cache (non-locking version). + + virtual int cache_i (const void *recycling_act); + // Add to cache (non-locking version). + + virtual int mark_as_closed_i (const void *recycling_act); + // Mark as closed (non-locking version). + + virtual int cleanup_hint_i (const void *recycling_act); + // Cleanup hint. + + // = Helpers + void check_hint_i (SVC_HANDLER *&sh, + HASH_ADDRESS &search_addr, + CONNECTION_MAP_ENTRY *&entry, + int &found); + + int find_or_create_svc_handler_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms, + HASH_ADDRESS &search_addr, + CONNECTION_MAP_ENTRY *&entry, + int &found); + CONNECTION_MAP connection_cache_; // Table that maintains the cache of connected s. -- cgit v1.2.1