summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Connector.h
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/IIOP_Connector.h')
-rw-r--r--TAO/tao/IIOP_Connector.h62
1 files changed, 61 insertions, 1 deletions
diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h
index 6b9eb5e576e..3a621f61071 100644
--- a/TAO/tao/IIOP_Connector.h
+++ b/TAO/tao/IIOP_Connector.h
@@ -30,7 +30,15 @@
#include "tao/Pluggable.h"
#include "tao/IIOP_Connect.h"
-typedef ACE_Strategy_Connector<TAO_IIOP_Client_Connection_Handler, TAO_SOCK_CONNECTOR>
+#include "tao/Resource_Factory.h"
+
+#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ < 8
+#define ACE_HAS_BROKEN_EXTENDED_TEMPLATES
+#endif /* __GNUC__ */
+
+#include "ace/Cached_Connect_Strategy_T.h"
+
+typedef ACE_Strategy_Connector<TAO_IIOP_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
TAO_IIOP_BASE_CONNECTOR;
// ****************************************************************
@@ -88,6 +96,37 @@ public:
virtual char object_key_delimiter (void) const;
+ // = Connection Caching Strategy. Used with TAO_IIOP_Connector.
+ typedef size_t ATTRIBUTES;
+ typedef ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr>
+ IIOP_ADDR;
+ typedef ACE_Pair<TAO_IIOP_Client_Connection_Handler *, ATTRIBUTES>
+ IIOP_CACHED_HANDLER;
+ typedef ACE_Hash<IIOP_ADDR> IIOP_HASH_KEY;
+ typedef ACE_Equal_To<IIOP_ADDR> IIOP_CMP_KEYS;
+ typedef ACE_Hash_Map_Manager_Ex<IIOP_ADDR, IIOP_CACHED_HANDLER, IIOP_HASH_KEY, IIOP_CMP_KEYS, ACE_Null_Mutex>
+ IIOP_HASH_MAP;
+ typedef ACE_Hash_Map_Iterator_Ex<IIOP_ADDR, IIOP_CACHED_HANDLER, IIOP_HASH_KEY, IIOP_CMP_KEYS, ACE_Null_Mutex>
+ IIOP_HASH_ITERATOR;
+ typedef ACE_Hash_Map_Reverse_Iterator_Ex<IIOP_ADDR, IIOP_CACHED_HANDLER, IIOP_HASH_KEY, IIOP_CMP_KEYS, ACE_Null_Mutex>
+ IIOP_HASH_REVERSE_ITERATOR;
+ typedef ACE_Recyclable_Handler_Cleanup_Strategy<IIOP_ADDR, IIOP_CACHED_HANDLER, IIOP_HASH_MAP>
+ IIOP_CLEANUP_STRATEGY;
+ typedef ACE_Recyclable_Handler_Caching_Utility<IIOP_ADDR, IIOP_CACHED_HANDLER, IIOP_HASH_MAP, IIOP_HASH_ITERATOR, ATTRIBUTES>
+ IIOP_CACHING_UTILITY;
+#if defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+ typedef ACE_LRU_Caching_Strategy<ATTRIBUTES, IIOP_CACHING_UTILITY>
+ IIOP_CACHING_STRATEGY;
+#else
+ typedef ACE_Caching_Strategy<ATTRIBUTES, IIOP_CACHING_UTILITY>
+ IIOP_CACHING_STRATEGY;
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+ typedef ACE_Cached_Connect_Strategy_Ex<TAO_IIOP_Client_Connection_Handler, ACE_SOCK_CONNECTOR, IIOP_CACHING_STRATEGY, ATTRIBUTES, TAO_Cached_Connector_Lock>
+ TAO_CACHED_CONNECT_STRATEGY;
+
+ virtual TAO_CACHED_CONNECT_STRATEGY &cached_connect_strategy (void);
+ // Accessor to the connect strategy.
+
protected:
// = More TAO_Connector methods, please check the documentation on
// Pluggable.h
@@ -95,6 +134,9 @@ protected:
TAO_Profile *&,
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ());
+ virtual int make_connection_caching_strategy (void);
+ // According to the option specified, create the appropriate caching strategy used for purging
+ // unused connections from the connection cache.
protected:
typedef ACE_NOOP_Concurrency_Strategy<TAO_IIOP_Client_Connection_Handler>
TAO_NULL_ACTIVATION_STRATEGY;
@@ -102,10 +144,28 @@ protected:
typedef ACE_NOOP_Creation_Strategy<TAO_IIOP_Client_Connection_Handler>
TAO_NULL_CREATION_STRATEGY;
+ enum
+ {
+ TAO_LRU, // Use Least Recently Used caching strategy
+ TAO_LFU, // Use Least Frequently Used caching strategy
+ TAO_FIFO, // Use First In First Out caching strategy
+ TAO_NULL // Dont use any strategy.
+ };
+
private:
TAO_NULL_ACTIVATION_STRATEGY null_activation_strategy_;
TAO_NULL_CREATION_STRATEGY null_creation_strategy_;
+ TAO_CACHED_CONNECT_STRATEGY *cached_connect_strategy_;
+ // This is the connection strategy.
+
+ IIOP_CACHING_STRATEGY *caching_strategy_;
+ // This is the caching strategy which decides the order of removal
+ // of entries from the connection cache. This can be decided at
+ // run-time by using the -ORBConnectionCachingStrategy option. The
+ // choices are: Least Recently Used, Least Frequently Used, First In
+ // First Out, and Null (which does nothing). By default, LRU is used.
+
TAO_IIOP_BASE_CONNECTOR base_connector_;
// The connector initiating connection requests for IIOP.