summaryrefslogtreecommitdiff
path: root/TAO/tao/Connection_Cache_Manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/Connection_Cache_Manager.h')
-rw-r--r--TAO/tao/Connection_Cache_Manager.h69
1 files changed, 55 insertions, 14 deletions
diff --git a/TAO/tao/Connection_Cache_Manager.h b/TAO/tao/Connection_Cache_Manager.h
index d7eaf7e32c6..517dcfd2dbe 100644
--- a/TAO/tao/Connection_Cache_Manager.h
+++ b/TAO/tao/Connection_Cache_Manager.h
@@ -18,14 +18,22 @@
#define TAO_CONNECTION_CACHE_MANAGER_H
#include "ace/pre.h"
-#include "tao/Hash_Map_Manager_T.h"
-
-
+#include "ace/Hash_Map_Manager_T.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "tao/TAO_Export.h"
+#include "tao/Cache_Entries.h"
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
class TAO_Cache_ExtId;
class TAO_Cache_IntId;
@@ -49,20 +57,15 @@ public:
ACE_Null_Mutex>
HASH_MAP_ITER;
- typedef ACE_Hash_Map_Reverse_Iterator <TAO_Cache_ExtId,
- TAO_Cache_IntId,
- ACE_Null_Mutex>
- HASH_MAP_REV_ITER;
+ typedef ACE_Hash_Map_Entry <TAO_Cache_ExtId,
+ TAO_Cache_IntId>
+ HASH_MAP_ENTRY;
// == Public methods
TAO_Connection_Cache_Manager (void);
// Constructor
- TAO_Connection_Cache_Manager (
- ACE_Caching_Strategy<ATTRBIBUTES, CACHING_UTILITY> *strat);
- // Constructor
-
virtual ~TAO_Connection_Cache_Manager (void);
// Destructor
@@ -70,8 +73,8 @@ public:
ACE_Allocator *alloc = 0);
// Initialize a <HASH_MAP> with <size> elements.
- int bind (const TAO_Cache_ExtId &ext_id,
- const TAO_Cache_IntId &int_id);
+ int bind (TAO_Cache_ExtId &ext_id,
+ TAO_Cache_IntId &int_id);
// Associate <ext_id> with <int_id>. If <ext_id> is already in the
// map then the <Map_Entry> is not changed. Returns 0 if a new
// entry is bound successfully, returns 1 if an attempt is made to
@@ -111,22 +114,60 @@ public:
int purge (void);
// Remove entries from the cache depending upon the strategy.
+ int make_idle (HASH_MAP_ENTRY *&entry);
+ // Make the entry idle and ready for use.
+
size_t current_size (void) const;
// Return the current size of the cache.
size_t total_size (void) const;
// Return the total size of the cache.
-protected:
+private:
+ int bind_i (TAO_Cache_ExtId &ext_id,
+ TAO_Cache_IntId &int_id);
+ // Non-Locking version of bind () call
+
+ int find_i (const TAO_Cache_ExtId &key,
+ TAO_Cache_IntId &value);
+ // Non-locking version of find () call
+
+ int rebind_i (const TAO_Cache_ExtId &key,
+ const TAO_Cache_IntId &value);
+ // Non-locking version of rebind () call
+
+ int trybind_i (const TAO_Cache_ExtId &key,
+ TAO_Cache_IntId &value);
+ // Non-locking version of trybind () call
+ int unbind_i (const TAO_Cache_ExtId &key);
+ // Non-locking version of unbind () call
+ int unbind_i (const TAO_Cache_ExtId &key,
+ TAO_Cache_IntId &value);
+ // Non-locking version of unbind () call
+ int make_idle_i (HASH_MAP_ENTRY *&entry);
+ // Non-locking version of make_idle ()
+ int get_last_index_bind (TAO_Cache_ExtId &key,
+ TAO_Cache_IntId &val,
+ HASH_MAP_ENTRY *&entry);
+ // Get the last index in the particular ext_id and try to bind that
+ // to the Cache map.
+ int get_idle_handler (const TAO_Cache_ExtId &ext_id,
+ HASH_MAP_ENTRY *&entry);
+ // Get an idle handler if one is available in Cache
+private:
+ HASH_MAP cache_map_;
+ // The hash map that has the connections
+ ACE_Lock *cache_lock_;
+ // Lock for the map
};
#if defined (__ACE_INLINE__)