summaryrefslogtreecommitdiff
path: root/TAO/tao/Transport_Cache_Manager.h
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2002-04-04 04:26:10 +0000
committerbala <balanatarajan@users.noreply.github.com>2002-04-04 04:26:10 +0000
commit725e73703a67326ed06452ca975b5378ad84c03b (patch)
tree866f51c285d8f0d3c1cd2a53a0194d493825e847 /TAO/tao/Transport_Cache_Manager.h
parentddf00484367e672294353272d1c670964963ba00 (diff)
downloadATCD-725e73703a67326ed06452ca975b5378ad84c03b.tar.gz
ChangeLogTag: Wed Apr 3 22:18:38 2002 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Transport_Cache_Manager.h')
-rw-r--r--TAO/tao/Transport_Cache_Manager.h88
1 files changed, 48 insertions, 40 deletions
diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h
index 0454ab4fe2b..5a87d7f7e72 100644
--- a/TAO/tao/Transport_Cache_Manager.h
+++ b/TAO/tao/Transport_Cache_Manager.h
@@ -15,19 +15,26 @@
#define TAO_CONNECTION_CACHE_MANAGER_H
#include "ace/pre.h"
-#include "ace/Hash_Map_Manager_T.h"
+#include "tao/Cache_Entries.h"
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
+#include "ace/Hash_Map_Manager_T.h"
+#include "ace/Synch_T.h"
+
+// #include "tao/TAO_Export.h"
+// #include "tao/Cache_Entries.h"
+// #include "tao/Connection_Purging_Strategy.h"
-#include "tao/TAO_Export.h"
-#include "tao/Cache_Entries.h"
-#include "tao/Connection_Purging_Strategy.h"
class TAO_ORB_Core;
class ACE_Handle_Set;
class TAO_Resource_Factory;
+class TAO_Connection_Purging_Strategy;
+
+template <class ACE_COND_MUTEX> class TAO_Condition;
typedef ACE_Unbounded_Set<ACE_Event_Handler*> TAO_EventHandlerSet;
typedef ACE_Unbounded_Set_Iterator<ACE_Event_Handler*>
@@ -36,19 +43,16 @@ typedef ACE_Unbounded_Set_Iterator<ACE_Event_Handler*>
/**
* @class TAO_Transport_Cache_Manager
*
- * @brief The Transport Cache Manager for TAO.
+ * @brief The Transport Cache Manager for TAO
*
- * This class provides interfaces associating a TAO_Cache_ExtId and
- * TAO_Cache_IntId. This class manages a ACE_Hash_Map_Manager class
- * which is used as a container to Cache the connections. This class
- * protects the entries with a lock. The map can be updated only by
- * holding the lock.
+ * This class provides interfaces associating a TAO_Cache_ExtId
+ * & TAO_Cache_IntId. This class is wrapper around the
+ * ACE_Hash_Map_Manager class which is used as a container to Cache
+ * the connections. This class protects the entries with a lock. The
+ * map is updated only by holding the lock. The more compelling reason
+ * to have the lock in this class and not in the Hash_Map is that, we
+ * do quite a bit of work in this class for which we need a lock.
*
- * @note This class at present has an interface that may not be
- * needed. But, the interface has just been copied from the ACE
- * Hash Map Manager classes. The interface wold be pruned once I
- * get the purging stuff also in. Till then let the interface be
- * there as it is.
*/
class TAO_Export TAO_Transport_Cache_Manager
{
@@ -66,6 +70,9 @@ public:
typedef ACE_Hash_Map_Entry <TAO_Cache_ExtId,
TAO_Cache_IntId> HASH_MAP_ENTRY;
+ typedef TAO_Condition<TAO_SYNCH_MUTEX> CONDITION;
+
+ // == Public methods
/// Constructor
TAO_Transport_Cache_Manager (TAO_ORB_Core &orb_core);
@@ -117,19 +124,6 @@ private:
int find (const TAO_Cache_ExtId &key,
TAO_Cache_IntId &value);
- /// Reassociate the <key> with <value>. Grabs the lock and calls the
- /// implementation function find_i.
- int rebind (const TAO_Cache_ExtId &key,
- const TAO_Cache_IntId &value);
-
- /// Remove <key> from the cache.
- int unbind (const TAO_Cache_ExtId &key);
-
- /// Remove <key> from the cache, and return the <value> associated with
- /// <key>.
- int unbind (const TAO_Cache_ExtId &key,
- TAO_Cache_IntId &value);
-
/**
* Non-Locking version and actual implementation of bind ()
* call. Calls bind on the Hash_Map_Manager that it holds. If the
@@ -150,17 +144,6 @@ private:
int find_i (const TAO_Cache_ExtId &key,
TAO_Cache_IntId &value);
- /// Non-locking version and actual implementation of rebind () call
- int rebind_i (const TAO_Cache_ExtId &key,
- const TAO_Cache_IntId &value);
-
- /// Non-locking version and actual implementation of unbind () call
- int unbind_i (const TAO_Cache_ExtId &key);
-
- /// Non-locking version and actual implementation of unbind () call
- int unbind_i (const TAO_Cache_ExtId &key,
- TAO_Cache_IntId &value);
-
/// Non-locking version and actual implementation of make_idle ().
int make_idle_i (HASH_MAP_ENTRY *&entry);
@@ -213,7 +196,17 @@ private:
/// the required number of items in the set.
void close_entries (DESCRIPTOR_SET& sorted_set, int size);
+ /// Wait for connections if we have reached the limit on the number
+ /// of muxed connections. If not (ie. if we dont use a muxed
+ /// connection or if we have not reached the limit) this just
+ /// behaves as a no-op. <extid> has all the information about the
+ /// connection that is being searched.
+ int wait_for_connection (TAO_Cache_ExtId &extid);
+
+ /// Is the wakeup useful todo some work?
+ int is_wakeup_useful (TAO_Cache_ExtId &extid);
private:
+
/// The percentage of the cache to purge at one time
int percent_;
@@ -223,8 +216,23 @@ private:
/// The hash map that has the connections
HASH_MAP cache_map_;
- /// Lock for the map
+ /// The condition variable
+ CONDITION *condition_;
+
+ /// The lock that is used by the cache map
ACE_Lock *cache_lock_;
+
+ /// Number of allowed muxed connections
+ CORBA::ULong muxed_number_;
+
+ /// Number of threads waiting for connections
+ int no_waiting_threads_;
+
+ /// This is for optimization purposes. In a situation where number
+ /// of threads are waiting for connections, the last connection that
+ /// is put back is cached here. This should prevent all th threads
+ /// trying to search for their required entry.
+ TAO_Cache_ExtId *last_entry_returned_;
};
#if defined (__ACE_INLINE__)