summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/version_tests.dsw13
-rw-r--r--ace/Cache_Map_Manager_T.cpp99
-rw-r--r--ace/Cache_Map_Manager_T.h43
-rw-r--r--ace/Cache_Map_Manager_T.i216
-rw-r--r--ace/Cached_Connect_Strategy_T.cpp52
-rw-r--r--ace/Cached_Connect_Strategy_T.h18
-rw-r--r--ace/Caching_Strategies_T.cpp350
-rw-r--r--ace/Caching_Strategies_T.h240
-rw-r--r--ace/Caching_Strategies_T.i317
-rw-r--r--ace/Caching_Utility_T.cpp162
-rw-r--r--ace/Caching_Utility_T.h159
-rw-r--r--ace/Cleanup_Strategies_T.cpp37
-rw-r--r--ace/Cleanup_Strategies_T.h49
-rw-r--r--ace/Hash_Cache_Map_Manager_T.cpp2
-rw-r--r--ace/Hash_Cache_Map_Manager_T.h31
-rw-r--r--tests/Cache_Map_Manager_Test.cpp188
-rw-r--r--tests/Cached_Conn_Test.cpp567
-rw-r--r--tests/Cached_Conn_Test.dsp194
-rw-r--r--tests/Conn_Test.cpp10
-rw-r--r--tests/Map_Manager_Test.cpp44
-rw-r--r--tests/tests.dsw12
21 files changed, 1377 insertions, 1426 deletions
diff --git a/TAO/version_tests.dsw b/TAO/version_tests.dsw
index c8e2e47b8bc..02d2f802dae 100644
--- a/TAO/version_tests.dsw
+++ b/TAO/version_tests.dsw
@@ -210,6 +210,18 @@ Package=<4>
###############################################################################
+Project: "Cached_Conn_Test"=..\tests\Cached_Conn_Test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Callback Quoter Consumer"=.\examples\Callback_Quoter\Consumer.dsp - Package Owner=<4>
Package=<5>
@@ -3554,3 +3566,4 @@ Package=<3>
}}}
###############################################################################
+
diff --git a/ace/Cache_Map_Manager_T.cpp b/ace/Cache_Map_Manager_T.cpp
index 376f981e5e4..6d7d0770773 100644
--- a/ace/Cache_Map_Manager_T.cpp
+++ b/ace/Cache_Map_Manager_T.cpp
@@ -21,17 +21,26 @@ ACE_RCSID(ace, Cache_Map_Manager_T, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Manager)
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator)
ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator)
-#define T_1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
-#define T_2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
+#define ACE_T1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
+
+#else
+
+#define ACE_T1 class KEY, class VALUE, class MAP, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, CACHING_STRATEGY, ATTRIBUTES
- template <T_1>
-ACE_Cache_Map_Manager<T_2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
- size_t size,
- ACE_Allocator *alloc)
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+template <ACE_T1>
+ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
+ size_t size,
+ ACE_Allocator *alloc)
: caching_strategy_ (caching_s)
{
if (this->open (size, alloc) == -1)
@@ -41,29 +50,29 @@ ACE_Cache_Map_Manager<T_2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
}
-template <T_1>
-ACE_Cache_Map_Manager<T_2>::~ACE_Cache_Map_Manager (void)
+template <ACE_T1>
+ACE_Cache_Map_Manager<ACE_T2>::~ACE_Cache_Map_Manager (void)
{
this->close ();
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::open (size_t length,
- ACE_Allocator *alloc)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::open (size_t length,
+ ACE_Allocator *alloc)
{
return this->map_.open (length,
alloc);
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::close (void)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::close (void)
{
return this->map_.close ();
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::bind (const KEY &key,
- const VALUE &value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::bind (const KEY &key,
+ const VALUE &value)
{
// Insert an entry which has the <key> and the <cache_value> which
// is the combination of the <value> and the attributes of the
@@ -97,9 +106,9 @@ ACE_Cache_Map_Manager<T_2>::bind (const KEY &key,
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
- const VALUE &value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
+ const VALUE &value)
{
CACHE_VALUE cache_value (value,
this->caching_strategy_.attributes ());
@@ -134,10 +143,10 @@ ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
- const VALUE &value,
- VALUE &old_value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
+ const VALUE &value,
+ VALUE &old_value)
{
CACHE_VALUE cache_value (value,
this->caching_strategy_.attributes ());
@@ -181,11 +190,11 @@ ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
return rebind_result;
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
- const VALUE &value,
- KEY &old_key,
- VALUE &old_value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
+ const VALUE &value,
+ KEY &old_key,
+ VALUE &old_value)
{
CACHE_VALUE cache_value (value,
this->caching_strategy_.attributes ());
@@ -230,9 +239,9 @@ ACE_Cache_Map_Manager<T_2>::rebind (const KEY &key,
return rebind_result;
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::trybind (const KEY &key,
- VALUE &value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key,
+ VALUE &value)
{
CACHE_VALUE cache_value (value,
this->caching_strategy_.attributes ());
@@ -272,9 +281,9 @@ ACE_Cache_Map_Manager<T_2>::trybind (const KEY &key,
return trybind_result;
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::find (const KEY &key,
- VALUE &value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key,
+ VALUE &value)
{
// Lookup the key and populate the <value>.
CACHE_VALUE cache_value;
@@ -311,8 +320,8 @@ ACE_Cache_Map_Manager<T_2>::find (const KEY &key,
return find_result;
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::find (const KEY &key)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key)
{
// Lookup the key and populate the <value>.
CACHE_VALUE cache_value;
@@ -349,8 +358,8 @@ ACE_Cache_Map_Manager<T_2>::find (const KEY &key)
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::unbind (const KEY &key)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key)
{
// Remove the entry from the cache.
CACHE_VALUE cache_value;
@@ -372,9 +381,9 @@ ACE_Cache_Map_Manager<T_2>::unbind (const KEY &key)
return unbind_result;
}
-template <T_1> int
-ACE_Cache_Map_Manager<T_2>::unbind (const KEY &key,
- VALUE &value)
+template <ACE_T1> int
+ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key,
+ VALUE &value)
{
// Remove the entry from the cache.
CACHE_VALUE cache_value;
@@ -399,15 +408,15 @@ ACE_Cache_Map_Manager<T_2>::unbind (const KEY &key,
}
-template <T_1> void
-ACE_Cache_Map_Manager<T_2>::dump (void) const
+template <ACE_T1> void
+ACE_Cache_Map_Manager<ACE_T2>::dump (void) const
{
this->map_.dump ();
this->caching_strategy_.dump ();
}
-#undef T_1
-#undef T_2
+#undef ACE_T1
+#undef ACE_T2
#endif /* ACE_CACHE_MAP_MANAGER_T_C */
diff --git a/ace/Cache_Map_Manager_T.h b/ace/Cache_Map_Manager_T.h
index 20dfb3b9e1d..82033b28b09 100644
--- a/ace/Cache_Map_Manager_T.h
+++ b/ace/Cache_Map_Manager_T.h
@@ -28,13 +28,25 @@
// Forward declaration.
class ACE_Allocator;
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Iterator;
template <class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Reverse_Iterator;
-template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
+#define ACE_T1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
+
+#else
+
+#define ACE_T1 class KEY, class VALUE, class MAP, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, CACHING_STRATEGY, ATTRIBUTES
+
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+template <ACE_T1>
class ACE_Cache_Map_Manager
{
// = TITLE
@@ -58,12 +70,11 @@ public:
typedef VALUE mapped_type;
typedef MAP map_type;
typedef CACHING_STRATEGY caching_strategy_type;
+
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION;
typedef REVERSE_ITERATOR_IMPL REVERSE_ITERATOR_IMPLEMENTATION;
- typedef ACE_Pair<VALUE, ATTRIBUTES> CACHE_VALUE;
- // The actual value mapped to the key in the map. The <attributes>
- // are used by the strategy and is transparent to the user of this
- // class.
friend class ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>;
friend class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>;
@@ -80,6 +91,13 @@ public:
typedef REVERSE_ITERATOR
reverse_iterator;
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+ typedef ACE_Pair<VALUE, ATTRIBUTES> CACHE_VALUE;
+ // The actual value mapped to the key in the map. The <attributes>
+ // are used by the strategy and is transparent to the user of this
+ // class.
+
// = Initialization and termination methods.
ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy,
@@ -168,6 +186,8 @@ public:
void dump (void) const;
// Dumps the state of the object.
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
// = STL styled iterator factory functions.
ITERATOR begin (void);
@@ -178,6 +198,8 @@ public:
REVERSE_ITERATOR rend (void);
// Return reverse iterator.
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
MAP &map (void);
// The map managed by the Cache_Map_Manager.
@@ -195,11 +217,13 @@ protected:
private:
// = Disallow these operations.
- ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &))
- ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager<ACE_T2> &))
+ ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager<ACE_T2> &))
};
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
class ACE_Cache_Map_Iterator
{
@@ -347,6 +371,11 @@ protected:
// belonging to the Cache_Map_Manager.
};
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+#undef ACE_T1
+#undef ACE_T2
+
#if defined (__ACE_INLINE__)
#include "ace/Cache_Map_Manager_T.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Cache_Map_Manager_T.i b/ace/Cache_Map_Manager_T.i
index 1a199e8bc53..ab90786fe1b 100644
--- a/ace/Cache_Map_Manager_T.i
+++ b/ace/Cache_Map_Manager_T.i
@@ -1,259 +1,273 @@
/* -*- C++ -*- */
//$Id$
-#define T_1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
-#define T_2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
-template <T_1> ACE_INLINE int
-ACE_Cache_Map_Manager<T_2>::purge (void)
+#define ACE_T1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
+
+#else
+
+#define ACE_T1 class KEY, class VALUE, class MAP, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, MAP, CACHING_STRATEGY, ATTRIBUTES
+
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+template <ACE_T1> ACE_INLINE int
+ACE_Cache_Map_Manager<ACE_T2>::purge (void)
{
- return this->caching_strategy ().clear_cache (this->map_);
+ return this->caching_strategy ().caching_utility ().clear_cache (this->map_,
+ this->caching_strategy ().purge_percent ());
}
-template <T_1> ACE_INLINE size_t
-ACE_Cache_Map_Manager<T_2>::current_size (void) const
+template <ACE_T1> ACE_INLINE size_t
+ACE_Cache_Map_Manager<ACE_T2>::current_size (void) const
{
return this->map_.current_size ();
}
-template <T_1> ACE_INLINE size_t
-ACE_Cache_Map_Manager<T_2>::total_size (void) const
+template <ACE_T1> ACE_INLINE size_t
+ACE_Cache_Map_Manager<ACE_T2>::total_size (void) const
{
return this->map_.total_size ();
}
-template <T_1> ACE_INLINE MAP &
-ACE_Cache_Map_Manager<T_2>::map (void)
+template <ACE_T1> ACE_INLINE MAP &
+ACE_Cache_Map_Manager<ACE_T2>::map (void)
{
return this->map_;
}
-template <T_1> ACE_INLINE CACHING_STRATEGY &
-ACE_Cache_Map_Manager<T_2>::caching_strategy (void)
+template <ACE_T1> ACE_INLINE CACHING_STRATEGY &
+ACE_Cache_Map_Manager<ACE_T2>::caching_strategy (void)
{
return this->caching_strategy_;
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
-ACE_Cache_Map_Manager<T_2>::begin (void)
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
+ACE_Cache_Map_Manager<ACE_T2>::begin (void)
{
return ITERATOR (this->map_.begin ());
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
-ACE_Cache_Map_Manager<T_2>::end (void)
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
+ACE_Cache_Map_Manager<ACE_T2>::end (void)
{
return ITERATOR (this->map_.end ());
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
-ACE_Cache_Map_Manager<T_2>::rbegin (void)
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
+ACE_Cache_Map_Manager<ACE_T2>::rbegin (void)
{
return REVERSE_ITERATOR (this->map_.rbegin ());
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
-ACE_Cache_Map_Manager<T_2>::rend (void)
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>
+ACE_Cache_Map_Manager<ACE_T2>::rend (void)
{
return REVERSE_ITERATOR (this->map_.rend ());
}
-#undef T_1
-#undef T_2
+#undef ACE_T1
+#undef ACE_T2
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
-#define T_1 class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES
-#define T_2 KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES
+#define ACE_T1 class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2>::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator <T_2> &rhs)
- : iterator_implementation_ (rhs.iterator_implementation_)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2>::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator <ACE_T2> &rhs)
+ : iterator_implementation_ (rhs.iterator_implementation_)
{
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2>::~ACE_Cache_Map_Iterator (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2>::~ACE_Cache_Map_Iterator (void)
{
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Iterator<T_2> &
-ACE_Cache_Map_Iterator<T_2>::operator= (const ACE_Cache_Map_Iterator<T_2> &rhs)
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Iterator<ACE_T2> &
+ACE_Cache_Map_Iterator<ACE_T2>::operator= (const ACE_Cache_Map_Iterator<ACE_T2> &rhs)
{
this->iterator_implementation_ = rhs.iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE int
-ACE_Cache_Map_Iterator<T_2>::operator== (const ACE_Cache_Map_Iterator<T_2> &rhs) const
+template <ACE_T1> ACE_INLINE int
+ACE_Cache_Map_Iterator<ACE_T2>::operator== (const ACE_Cache_Map_Iterator<ACE_T2> &rhs) const
{
return this->iterator_implementation_ == rhs.iterator_implementation_;
}
-template <T_1> ACE_INLINE int
-ACE_Cache_Map_Iterator<T_2>::operator!= (const ACE_Cache_Map_Iterator<T_2> &rhs) const
+template <ACE_T1> ACE_INLINE int
+ACE_Cache_Map_Iterator<ACE_T2>::operator!= (const ACE_Cache_Map_Iterator<ACE_T2> &rhs) const
{
return this->iterator_implementation_ != rhs.iterator_implementation_;
}
-template <T_1> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
-ACE_Cache_Map_Iterator<T_2>::operator* (void) const
+template <ACE_T1> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
+ACE_Cache_Map_Iterator<ACE_T2>::operator* (void) const
{
value_type retn ((*this->iterator_implementation_).ext_id_,
(*this->iterator_implementation_).int_id_.first ());
return retn;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2> &
-ACE_Cache_Map_Iterator<T_2>::operator++ (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2> &
+ACE_Cache_Map_Iterator<ACE_T2>::operator++ (void)
{
++this->iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2>
-ACE_Cache_Map_Iterator<T_2>::operator++ (int)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2>
+ACE_Cache_Map_Iterator<ACE_T2>::operator++ (int)
{
- ACE_Cache_Map_Iterator<T_2> retn = *this;
+ ACE_Cache_Map_Iterator<ACE_T2> retn = *this;
++this->iterator_implementation_;
return retn;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2> &
-ACE_Cache_Map_Iterator<T_2>::operator-- (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2> &
+ACE_Cache_Map_Iterator<ACE_T2>::operator-- (void)
{
--this->iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2>
-ACE_Cache_Map_Iterator<T_2>::operator-- (int)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2>
+ACE_Cache_Map_Iterator<ACE_T2>::operator-- (int)
{
- ACE_Cache_Map_Iterator<T_2> retn = *this;
+ ACE_Cache_Map_Iterator<ACE_T2> retn = *this;
--this->iterator_implementation_;
return retn;
}
-template <T_1> ACE_INLINE void
-ACE_Cache_Map_Iterator<T_2>::dump (void) const
+template <ACE_T1> ACE_INLINE void
+ACE_Cache_Map_Iterator<ACE_T2>::dump (void) const
{
this->iterator_implementation_.dump ();
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Iterator<T_2>::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl)
- : iterator_implementation_ (iterator_impl)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Iterator<ACE_T2>::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl)
+ : iterator_implementation_ (iterator_impl)
{
}
-template <T_1> ACE_INLINE IMPLEMENTATION &
-ACE_Cache_Map_Iterator<T_2>::iterator_implementation (void)
+template <ACE_T1> ACE_INLINE IMPLEMENTATION &
+ACE_Cache_Map_Iterator<ACE_T2>::iterator_implementation (void)
{
return this->iterator_implementation_;
}
-#undef T_1
-#undef T_2
+#undef ACE_T1
+#undef ACE_T2
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
-#define T_1 class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES
-#define T_2 KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES
+#define ACE_T1 class KEY, class VALUE, class REVERSE_IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES
+#define ACE_T2 KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2>::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator <T_2> &rhs)
- : reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator <ACE_T2> &rhs)
+ : reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_)
{
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2>::~ACE_Cache_Map_Reverse_Iterator (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::~ACE_Cache_Map_Reverse_Iterator (void)
{
}
-template <T_1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<T_2> &
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator= (const ACE_Cache_Map_Reverse_Iterator<T_2> &rhs)
+template <ACE_T1> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<ACE_T2> &
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator= (const ACE_Cache_Map_Reverse_Iterator<ACE_T2> &rhs)
{
this->reverse_iterator_implementation_ = rhs.reverse_iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE int
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator== (const ACE_Cache_Map_Reverse_Iterator<T_2> &rhs) const
+template <ACE_T1> ACE_INLINE int
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator== (const ACE_Cache_Map_Reverse_Iterator<ACE_T2> &rhs) const
{
return this->reverse_iterator_implementation_ == rhs.reverse_iterator_implementation_;
}
-template <T_1> ACE_INLINE int
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator!= (const ACE_Cache_Map_Reverse_Iterator<T_2> &rhs) const
+template <ACE_T1> ACE_INLINE int
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator!= (const ACE_Cache_Map_Reverse_Iterator<ACE_T2> &rhs) const
{
return this->reverse_iterator_implementation_ != rhs.reverse_iterator_implementation_;
}
-template <T_1> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator* (void) const
+template <ACE_T1> ACE_INLINE ACE_Reference_Pair<KEY, VALUE>
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator* (void) const
{
value_type retv ((*this->reverse_iterator_implementation_).ext_id_,
(*this->reverse_iterator_implementation_).int_id_.first ());
return retv;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2> &
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator++ (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2> &
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator++ (void)
{
++this->reverse_iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2>
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator++ (int)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator++ (int)
{
- ACE_Cache_Map_Reverse_Iterator<T_2> retn = *this;
+ ACE_Cache_Map_Reverse_Iterator<ACE_T2> retn = *this;
++this->reverse_iterator_implementation_;
return retn;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2> &
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator-- (void)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2> &
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator-- (void)
{
--this->reverse_iterator_implementation_;
return *this;
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2>
-ACE_Cache_Map_Reverse_Iterator<T_2>::operator-- (int)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::operator-- (int)
{
- ACE_Cache_Map_Reverse_Iterator<T_2> retn = *this;
+ ACE_Cache_Map_Reverse_Iterator<ACE_T2> retn = *this;
--this->reverse_iterator_implementation_;
return retn;
}
-template <T_1> ACE_INLINE void
-ACE_Cache_Map_Reverse_Iterator<T_2>::dump (void) const
+template <ACE_T1> ACE_INLINE void
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::dump (void) const
{
this->reverse_iterator_implementation_.dump ();
}
-template <T_1> ACE_INLINE
-ACE_Cache_Map_Reverse_Iterator<T_2>::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl)
- : reverse_iterator_implementation_(iterator_impl)
+template <ACE_T1> ACE_INLINE
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl)
+ : reverse_iterator_implementation_(iterator_impl)
{
}
-template <T_1> ACE_INLINE REVERSE_IMPLEMENTATION &
-ACE_Cache_Map_Reverse_Iterator<T_2>::iterator_implementation (void)
+template <ACE_T1> ACE_INLINE REVERSE_IMPLEMENTATION &
+ACE_Cache_Map_Reverse_Iterator<ACE_T2>::iterator_implementation (void)
{
return this->reverse_iterator_implementation_;
}
-#undef T_1
-#undef T_2
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
+#undef ACE_T1
+#undef ACE_T2
diff --git a/ace/Cached_Connect_Strategy_T.cpp b/ace/Cached_Connect_Strategy_T.cpp
index 7fb4e9dacef..02f5c98a6e6 100644
--- a/ace/Cached_Connect_Strategy_T.cpp
+++ b/ace/Cached_Connect_Strategy_T.cpp
@@ -25,7 +25,7 @@
ACE_RCSID(ace, Cached_Connect_Strategy_T, "$Id$")
-template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
+ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::ACE_Cached_Connect_Strategy_Ex
(CACHING_STRATEGY &caching_s,
ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
@@ -45,8 +45,9 @@ ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATE
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::~ACE_Cached_Connect_Strategy_Ex (void)
{
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
// Close down all cached service handlers.
- for (CONNECTION_CACHE_ITERATOR iter = this->connection_cache_.begin ();
+ for (CONNECTION_CACHE::ITERATOR iter = this->connection_cache_.begin ();
iter != this->connection_cache_.end ();
++iter)
{
@@ -56,26 +57,7 @@ ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATE
(*iter).second ()->close ();
}
}
-}
-
-template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
-ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::open
-(ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
- ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
- ACE_Recycling_Strategy<SVC_HANDLER> *rec_s)
-{
- int result = this->CCSBASE::open (cre_s, con_s, rec_s);
- if (result == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("Base initialisation failed\n")),
- -1);
-
- if (this->caching_strategy ().open (&this->svc_cleanup_strategy_,
- 0) == -1)
- return -1;
-
- return 0;
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
}
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
@@ -178,12 +160,12 @@ ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATE
// Connect using the svc_handler.
if (this->cached_connect (sh,
- remote_addr,
- timeout,
- local_addr,
- reuse_addr,
- flags,
- perms) == -1)
+ remote_addr,
+ timeout,
+ local_addr,
+ reuse_addr,
+ flags,
+ perms) == -1)
{
return -1;
}
@@ -218,12 +200,12 @@ ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATE
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cached_connect (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)
+ 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)
{
// Actively establish the connection. This is a timed blocking
// connect.
@@ -243,7 +225,7 @@ ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATE
if (errno == EWOULDBLOCK)
errno = ENOTSUP;
- else if (errno == EMFILE)
+ else if (errno == EMFILE || errno == ENOBUFS || errno == ENOENT)
{
// If the connect failed due to the process running out of
// file descriptors then, auto_purging of some connections
diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h
index 59f070c9a46..23f49c63cab 100644
--- a/ace/Cached_Connect_Strategy_T.h
+++ b/ace/Cached_Connect_Strategy_T.h
@@ -57,12 +57,6 @@ public:
virtual ~ACE_Cached_Connect_Strategy_Ex (void);
// Destructor
- virtual int open (ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
- ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
- ACE_Recycling_Strategy<SVC_HANDLER> *rec_s);
- // This methods allow you to change the strategies used by the
- // cached connector.
-
virtual int cached_connect (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -84,7 +78,7 @@ public:
// = Typedefs for managing the map
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>
REFCOUNTED_HASH_RECYCLABLE_ADDRESS;
- typedef ACE_Hash_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>,ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, CACHING_STRATEGY, ATTRIBUTES>
+ typedef ACE_Hash_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, CACHING_STRATEGY, ATTRIBUTES>
CONNECTION_CACHE;
typedef ACE_TYPENAME CONNECTION_CACHE::CACHE_ENTRY
CONNECTION_CACHE_ENTRY;
@@ -92,12 +86,10 @@ public:
KEY;
typedef ACE_TYPENAME CONNECTION_CACHE::mapped_type
VALUE;
- typedef ACE_TYPENAME CONNECTION_CACHE::ITERATOR
- CONNECTION_CACHE_ITERATOR;
// = Cleanup of the svc_handler.
- typedef ACE_Svc_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, ACE_Pair<SVC_HANDLER *, ATTRIBUTES>,ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, ACE_Pair<SVC_HANDLER *, ATTRIBUTES>, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, MUTEX> >
- SVC_CLEANUP_STRATEGY;
+ typedef ACE_Recyclable_Handler_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, ACE_Pair<SVC_HANDLER *, ATTRIBUTES>,ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, ACE_Pair<SVC_HANDLER *, ATTRIBUTES>, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, MUTEX> >
+ CLEANUP_STRATEGY;
typedef ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>
CCSBASE;
@@ -153,10 +145,6 @@ protected:
CONNECTION_CACHE connection_cache_;
// Table that maintains the cache of connected <SVC_HANDLER>s.
-
- SVC_CLEANUP_STRATEGY svc_cleanup_strategy_;
- // The strategy which controls the destruction and closing of the
- // svc_handler.
};
#if !defined (ACE_LACKS_INLINE_FUNCTIONS)
diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp
index 532064ae23e..f36d593ad84 100644
--- a/ace/Caching_Strategies_T.cpp
+++ b/ace/Caching_Strategies_T.cpp
@@ -15,367 +15,39 @@
ACE_RCSID(ace, Caching_Strategies_T, "$Id$")
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_Caching_Strategy (void)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::~ACE_Caching_Strategy (void)
{
}
//////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_LRU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_LRU_Caching_Strategy (void)
: timer_ (0),
- purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
+ purge_percent_ (10)
{
- if (this->open (cleanup_s,
- delete_cleanup_strategy,
- utility_s,
- delete_caching_strategy_utility) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy")));
-
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_LRU_Caching_Strategy (void)
-{
- if (this->delete_cleanup_strategy_ == 1)
- delete this->cleanup_strategy_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- if (this->cleanup_strategy_ != 0 &&
- this->delete_cleanup_strategy_ == 1 &&
- cleanup_s != 0)
- {
- delete this->cleanup_strategy_;
- this->cleanup_strategy_ = 0;
- this->delete_cleanup_strategy_ = 0;
- }
-
- if (cleanup_s != 0)
- {
- this->cleanup_strategy_ = cleanup_s;
- this->delete_cleanup_strategy_ = delete_cleanup_strategy;
- }
- else if (this->cleanup_strategy_ == 0)
- {
- ACE_NEW_RETURN (this->cleanup_strategy_,
- CLEANUP_STRATEGY,
- -1);
-
- this->delete_cleanup_strategy_ = 1;
- }
-
- // Initialise the caching strategy utility.
-
- // First we decide whether we need to clean up.
- if (this->caching_strategy_utility_ != 0 &&
- this->delete_caching_strategy_utility_ == 1 &&
- utility_s != 0)
- {
- delete this->caching_strategy_utility_;
- this->caching_strategy_utility_ = 0;
- this->delete_caching_strategy_utility_ = 0;
- }
-
- if (utility_s != 0)
- {
- this->caching_strategy_utility_ = utility_s;
- this->delete_caching_strategy_utility_ = delete_caching_strategy_utility;
- }
- else if (this->caching_strategy_utility_ == 0)
- {
- ACE_NEW_RETURN (this->caching_strategy_utility_,
- CACHING_STRATEGY_UTILITY,
- -1);
-
- this->delete_caching_strategy_utility_ = 1;
- }
-
- return 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container)
-{
- return this->caching_strategy_utility_->clear_cache (container,
- this->cleanup_strategy_,
- this->purge_percent_);
}
////////////////////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_LFU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
- : purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
-{
- if (this->open (cleanup_s,
- delete_cleanup_strategy,
- utility_s,
- delete_caching_strategy_utility) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy")));
-
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_LFU_Caching_Strategy (void)
-{
- if (this->delete_cleanup_strategy_ == 1)
- delete this->cleanup_strategy_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- if (this->cleanup_strategy_ != 0 &&
- this->delete_cleanup_strategy_ == 1 &&
- cleanup_s != 0)
- {
- delete this->cleanup_strategy_;
- this->cleanup_strategy_ = 0;
- this->delete_cleanup_strategy_ = delete_cleanup_strategy;
- }
-
- if (cleanup_s != 0)
- this->cleanup_strategy_ = cleanup_s;
- else if (this->cleanup_strategy_ == 0)
- {
- ACE_NEW_RETURN (this->cleanup_strategy_,
- CLEANUP_STRATEGY,
- -1);
-
- this->delete_cleanup_strategy_ = 1;
- }
-
- // Initialise the caching strategy utility.
-
- // First we decide whether we need to clean up.
- if (this->caching_strategy_utility_ != 0 &&
- this->delete_caching_strategy_utility_ == 1 &&
- utility_s != 0)
- {
- delete this->caching_strategy_utility_;
- this->caching_strategy_utility_ = 0;
- this->delete_caching_strategy_utility_ = delete_caching_strategy_utility;
- }
-
- if (utility_s != 0)
- this->caching_strategy_utility_ = utility_s;
- else if (this->caching_strategy_utility_ == 0)
- {
- ACE_NEW_RETURN (this->caching_strategy_utility_,
- CACHING_STRATEGY_UTILITY,
- -1);
-
- this->delete_caching_strategy_utility_ = 1;
- }
-
- return 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_LFU_Caching_Strategy (void)
+ : purge_percent_ (10)
{
- return this->caching_strategy_utility_->clear_cache (container,
- this->cleanup_strategy_,
- this->purge_percent_);
}
-
////////////////////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_FIFO_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_FIFO_Caching_Strategy (void)
: order_ (0),
- purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
-{
- if (this->open (cleanup_s,
- delete_cleanup_strategy,
- utility_s,
- delete_caching_strategy_utility) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy")));
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_FIFO_Caching_Strategy (void)
-
+ purge_percent_ (10)
{
- if (this->delete_cleanup_strategy_ == 1)
- delete this->cleanup_strategy_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- if (this->cleanup_strategy_ != 0 &&
- this->delete_cleanup_strategy_ == 1 &&
- cleanup_s != 0)
- {
- delete this->cleanup_strategy_;
- this->cleanup_strategy_ = 0;
- this->delete_cleanup_strategy_ = delete_cleanup_strategy;
- }
-
- if (cleanup_s != 0)
- this->cleanup_strategy_ = cleanup_s;
- else if (this->cleanup_strategy_ == 0)
- {
- ACE_NEW_RETURN (this->cleanup_strategy_,
- CLEANUP_STRATEGY,
- -1);
-
- this->delete_cleanup_strategy_ = 1;
- }
-
- // Initialise the caching strategy utility.
-
- // First we decide whether we need to clean up.
- if (this->caching_strategy_utility_ != 0 &&
- this->delete_caching_strategy_utility_ == 1 &&
- utility_s != 0)
- {
- delete this->caching_strategy_utility_;
- this->caching_strategy_utility_ = 0;
- this->delete_caching_strategy_utility_ = delete_caching_strategy_utility;
- }
-
- if (utility_s != 0)
- this->caching_strategy_utility_ = utility_s;
- else if (this->caching_strategy_utility_ == 0)
- {
- ACE_NEW_RETURN (this->caching_strategy_utility_,
- CACHING_STRATEGY_UTILITY,
- -1);
-
- this->delete_caching_strategy_utility_ = 1;
- }
-
- return 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container)
-{
- return this->caching_strategy_utility_->clear_cache (container,
- this->cleanup_strategy_,
- this->purge_percent_);
}
////////////////////////////////////////////////////////////////////////////////////////////////
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_Null_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- ACE_UNUSED_ARG (cleanup_s);
- ACE_UNUSED_ARG (delete_cleanup_strategy);
- ACE_UNUSED_ARG (utility_s);
- ACE_UNUSED_ARG (delete_caching_strategy_utility);
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- ACE_UNUSED_ARG (cleanup_s);
- ACE_UNUSED_ARG (delete_cleanup_strategy);
- ACE_UNUSED_ARG (utility_s);
- ACE_UNUSED_ARG (delete_caching_strategy_utility);
-
- return 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_Null_Caching_Strategy (void)
-{
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container)
-{
- ACE_UNUSED_ARG (container);
-
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy)
ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy)
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy)
diff --git a/ace/Caching_Strategies_T.h b/ace/Caching_Strategies_T.h
index 44b5e31f096..41966b677f0 100644
--- a/ace/Caching_Strategies_T.h
+++ b/ace/Caching_Strategies_T.h
@@ -25,9 +25,11 @@
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/Cleanup_Strategies_T.h"
+#if defined(_MSC_VER)
+#pragma warning(disable:4503)
+#endif /* _MSC_VER */
-template <class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
+template <class ATTRIBUTES, class CACHING_UTILITY>
class ACE_Caching_Strategy
{
// = TITLE
@@ -42,12 +44,6 @@ public:
virtual ~ACE_Caching_Strategy (void);
// Destructor.
- virtual int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1) = 0;
- // This method which does the actual initialisation.
-
virtual ATTRIBUTES attributes (void) = 0;
// Accessor method for the timer attributes.
@@ -82,9 +78,8 @@ public:
// This method acts as a notification about the CONTAINERs rebind
// method call
- virtual int clear_cache (CONTAINER &container) = 0;
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
+ virtual CACHING_UTILITY &caching_utility (void) = 0;
+ // Purge the cache.
virtual void dump (void) const = 0;
// Dumps the state of the object.
@@ -92,8 +87,8 @@ public:
//////////////////////////////////////////////////////////////////////////
-template <class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION>
-class ACE_Caching_Strategy_Adapter : public ACE_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>
+template <class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION>
+class ACE_Caching_Strategy_Adapter : public ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
{
// = TITLE
// This class follows the Adaptor pattern and is used to provide
@@ -114,12 +109,6 @@ public:
~ACE_Caching_Strategy_Adapter (void);
// Destructor.
- int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // This method which does the actual initialisation.
-
ATTRIBUTES attributes (void);
// Accessor method for the timer attributes.
@@ -154,13 +143,12 @@ public:
// This method acts as a notification about the CONTAINERs rebind
// method call
- int clear_cache (CONTAINER &container);
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
-
IMPLEMENTATION &implementation (void);
// Accessor to the implementation.
+ CACHING_UTILITY &caching_utility (void);
+ // Purge the cache.
+
void dump (void) const;
// Dumps the state of the object.
@@ -175,7 +163,7 @@ private:
//////////////////////////////////////////////////////////////////////////
-template <class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
+template <class ATTRIBUTES, class CACHING_UTILITY>
class ACE_LRU_Caching_Strategy
{
// = TITLE
@@ -193,7 +181,7 @@ class ACE_LRU_Caching_Strategy
// The ATTRIBUTES are the deciding factor for purging of entries
// and should logically be included with the VALUE. Some ways of
// doing this are: As being a member of the VALUE or VALUE being
- // ACE_Pair<x, ATTRIBUTES>. The CACHING_STRATEGY_UTILITY is the
+ // ACE_Pair<x, ATTRIBUTES>. The CACHING_UTILITY is the
// class which can be plugged in and which decides the entries
// to purge.
@@ -201,37 +189,18 @@ public:
// Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
- typedef CONTAINER CACHE;
// = Initialisation and termination.
- ACE_LRU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // The <container> is the map in which the entries reside.
- // The Cleanup_Strategy is the callback class to which the entries
- // to be cleaned up will be delegated. The <delete_cleanup_strategy>
- // flag is needed to decide the ownership of the cleanup strategy.
- // Also, the timer attribute is initialed to zero in this constructor.
- // And the <purge_percent> field denotes the percentage of the entries
+ ACE_LRU_Caching_Strategy (void);
+ // The <container> is the map in which the entries reside. The
+ // timer attribute is initialed to zero in this constructor. And
+ // the <purge_percent> field denotes the percentage of the entries
// in the cache which can be purged automagically and by default is
- // set to 10%. The ultility which helps the caching strategy in the
- // purging of entries needs to be specified. By default a new one
- // will be created of type CACHING_STRATEGY_UTILITY and
- // <delete_caching_strategy_utility> decides whether to destroy the
- // utility object or not.
-
- ~ACE_LRU_Caching_Strategy (void);
+ // set to 10%.
// = Operations of the strategy.
- int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // This method which does the actual initialisation.
-
ATTRIBUTES attributes (void);
// Accessor method for the timer attributes.
@@ -268,17 +237,14 @@ public:
// This method acts as a notification about the CONTAINERs rebind
// method call
- int clear_cache (CONTAINER &container);
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
+ CACHING_UTILITY &caching_utility (void);
+ // Purge the cache.
void dump (void) const;
// Dumps the state of the object.
private:
- typedef ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
-
ATTRIBUTES timer_;
// This element is the one which is the deciding factor for purging
// of an ITEM.
@@ -286,31 +252,14 @@ private:
double purge_percent_;
// The level about which the purging will happen automagically.
- unsigned int entries_;
- // The no of entries bound in the cache.
-
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy_;
- // The cleanup strategy which can be used to destroy the entries of
- // the container.
-
- int delete_cleanup_strategy_;
- // The flag which denotes the ownership of the cleanup strategy.
- // If 1 then this class itself will destroy the strategy.
-
- CACHING_STRATEGY_UTILITY *caching_strategy_utility_;
+ CACHING_UTILITY caching_utility_;
// This is the helper class which will decide and expunge entries
// from the cache.
-
- int delete_caching_strategy_utility_;
- // The flag which denotes the ownership of the
- // caching_strategy_utility. If 1 then this class itself will
- // destroy the strategy utility object.
-
};
//////////////////////////////////////////////////////////////////////////
-template <class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
+template <class ATTRIBUTES, class CACHING_UTILITY>
class ACE_LFU_Caching_Strategy
{
// = TITLE
@@ -328,7 +277,7 @@ class ACE_LFU_Caching_Strategy
// The ATTRIBUTES are the deciding factor for purging of entries
// and should logically be included with the VALUE. Some ways of
// doing this are: As being a member of the VALUE or VALUE being
- // ACE_Pair<x, ATTRIBUTES>. The CACHING_STRATEGY_UTILITY is the
+ // ACE_Pair<x, ATTRIBUTES>. The CACHING_UTILITY is the
// class which can be plugged in and which decides the entries
// to purge.
@@ -336,34 +285,15 @@ public:
// Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
- typedef CONTAINER CACHE;
// = Initialisation and termination methods.
- ACE_LFU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // The <container> is the map in which the entries reside.
- // The Cleanup_Strategy is the callback class to which the entries
- // to be cleaned up will be delegated. The <delete_cleanup_strategy>
- // flag is needed to decide the ownership of the cleanup strategy.
- // Also, the timer attribute is initialed to zero in this constructor.
- // And the <purge_percent> field denotes the percentage of the entries
+ ACE_LFU_Caching_Strategy (void);
+ // The <container> is the map in which the entries reside. The
+ // timer attribute is initialed to zero in this constructor. And
+ // the <purge_percent> field denotes the percentage of the entries
// in the cache which can be purged automagically and by default is
- // set to 10%.The ultility which helps the caching strategy in the
- // purging of entries will be default be the
- // ACE_Caching_Strategy_Utility and the
- // <delete_caching_strategy_utility> decides whether to destroy the
- // utility or not.
-
- ~ACE_LFU_Caching_Strategy (void);
-
- int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // This method which does the actual initialisation.
+ // set to 10%.
// = Strategy methods.
@@ -401,45 +331,25 @@ public:
// This method acts as a notification about the CONTAINERs rebind
// method call
-
- int clear_cache (CONTAINER &container);
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
+ CACHING_UTILITY &caching_utility (void);
+ // Purge the cache.
void dump (void) const;
// Dumps the state of the object.
private:
- typedef ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
-
double purge_percent_;
// The level about which the purging will happen automagically.
- unsigned int entries_;
- // The no of entries bound in the cache.
-
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy_;
- // The cleanup strategy which can be used to destroy the entries of
- // the container.
-
- int delete_cleanup_strategy_;
- // The flag which denotes the ownership of the cleanup strategy.
- // If 1 then this class itself will destroy the strategy.
-
- CACHING_STRATEGY_UTILITY *caching_strategy_utility_;
+ CACHING_UTILITY caching_utility_;
// This is the helper class which will decide and expunge entries
// from the cache.
-
- int delete_caching_strategy_utility_;
- // The flag which denotes the ownership of the
- // caching_strategy_utility. If 1 then this class itself will
- // destroy the strategy utility object.
};
/////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
+template<class ATTRIBUTES, class CACHING_UTILITY>
class ACE_FIFO_Caching_Strategy
{
// = TITLE
@@ -455,41 +365,22 @@ class ACE_FIFO_Caching_Strategy
// The ATTRIBUTES are the deciding factor for purging of entries
// and should logically be included with the VALUE. Some ways of
// doing this are: As being a member of the VALUE or VALUE being
- // ACE_Pair<x, ATTRIBUTES>. The CACHING_STRATEGY_UTILITY is the
+ // ACE_Pair<x, ATTRIBUTES>. The CACHING_UTILITY is the
// class which can be plugged in and which decides the entries
// to purge.
public:
typedef ATTRIBUTES CACHING_ATTRIBUTES;
- typedef CONTAINER CACHE;
// = Initialisation and termination.
- ACE_FIFO_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // The <container> is the map in which the entries reside.
- // The Cleanup_Strategy is the callback class to which the entries
- // to be cleaned up will be delegated. The <delete_cleanup_strategy>
- // flag is needed to decide the ownership of the cleanup strategy.
- // Also, the timer attribute is initialed to zero in this constructor.
- // And the <purge_percent> field denotes the percentage of the entries
+ ACE_FIFO_Caching_Strategy (void);
+ // The <container> is the map in which the entries reside. The
+ // timer attribute is initialed to zero in this constructor. And
+ // the <purge_percent> field denotes the percentage of the entries
// in the cache which can be purged automagically and by default is
- // set to 10%.The ultility which helps the caching strategy in the
- // purging of entries will be default be the
- // ACE_Caching_Strategy_Utility and the
- // <delete_caching_strategy_utility> decides whether to destroy the
- // utility or not.
-
- ~ACE_FIFO_Caching_Strategy (void);
-
- int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // This method which does the actual initialisation.
+ // set to 10%.
// = Strategy methods.
@@ -526,17 +417,14 @@ public:
const ATTRIBUTES &attr);
// Notification for an item getting bound again into the cache.
- int clear_cache (CONTAINER &container);
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
+ CACHING_UTILITY &caching_utility (void);
+ // Purge the cache.
void dump (void) const;
// Dumps the state of the object.
private:
- typedef ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
-
ATTRIBUTES order_;
// The order is the deciding factor for the item to be removed from
// the cache.
@@ -544,29 +432,12 @@ private:
double purge_percent_;
// The level about which the purging will happen automagically.
- unsigned int entries_;
- // The no of entries bound in the cache.
-
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy_;
- // The cleanup strategy which can be used to destroy the entries of
- // the container.
-
- int delete_cleanup_strategy_;
- // The flag which denotes the ownership of the cleanup strategy.
- // If 1 then this class itself will destroy the strategy.
-
- CACHING_STRATEGY_UTILITY *caching_strategy_utility_;
+ CACHING_UTILITY caching_utility_;
// This is the helper class which will decide and expunge entries
// from the cache.
-
- int delete_caching_strategy_utility_;
- // The flag which denotes the ownership of the
- // caching_strategy_utility. If 1 then this class itself will
- // destroy the strategy utility object.
-
};
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
+template<class ATTRIBUTES, class CACHING_UTILITY>
class ACE_Null_Caching_Strategy
{
// = TITLE
@@ -581,23 +452,6 @@ public:
// = Traits.
typedef ATTRIBUTES CACHING_ATTRIBUTES;
- typedef CONTAINER CACHE;
-
- // = Initialisation and termination.
-
- ACE_Null_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
-
- ~ACE_Null_Caching_Strategy (void);
-
-
- int open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s = 0,
- int delete_cleanup_strategy = 1,
- CACHING_STRATEGY_UTILITY *utility_s = 0,
- int delete_caching_strategy_utility = 1);
- // This method which does the actual initialisation.
// = Strategy methods. All are NO_OP methods!!!
@@ -634,13 +488,17 @@ public:
const ATTRIBUTES &attr);
// Notification for an item getting bound again into the cache.
- int clear_cache (CONTAINER &container);
- // This is the method which looks at each ITEM's attributes and
- // then decides on the one to remove.
+ CACHING_UTILITY &caching_utility (void);
+ // Purge the cache.
void dump (void) const;
// Dumps the state of the object.
+private:
+
+ CACHING_UTILITY caching_utility_;
+ // This is the helper class which will decide and expunge entries
+ // from the cache.
};
#if defined (__ACE_INLINE__)
diff --git a/ace/Caching_Strategies_T.i b/ace/Caching_Strategies_T.i
index 8e114434cf2..2cfd63534aa 100644
--- a/ace/Caching_Strategies_T.i
+++ b/ace/Caching_Strategies_T.i
@@ -3,9 +3,9 @@
//////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation,
- int delete_implementation)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation,
+ int delete_implementation)
: implementation_ (implementation),
delete_implementation_ (delete_implementation)
{
@@ -17,100 +17,89 @@ ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY
}
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::~ACE_Caching_Strategy_Adapter (void)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::~ACE_Caching_Strategy_Adapter (void)
{
if (this->delete_implementation_)
- delete this->implementation_;
- this->delete_implementation_ = 0;
- this->implementation_ = 0;
-}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- return this->implementation_->open (cleanup_s,
- delete_cleanup_strategy,
- utility_s,
- delete_caching_strategy_utility);
+ {
+ delete this->implementation_;
+ this->delete_implementation_ = 0;
+ this->implementation_ = 0;
+ }
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE ATTRIBUTES
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::attributes (void)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE ATTRIBUTES
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::attributes (void)
{
return this->implementation_->attributes ();
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE double
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::purge_percent (void)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE double
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (void)
{
return this->implementation_->purge_percent ();
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE void
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::purge_percent (double percentage)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (double percentage)
{
this->implementation_->purge_percent (percentage);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::notify_bind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_bind (int result,
+ const ATTRIBUTES &attr)
{
return this->implementation_->notify_bind (result,
attr);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::notify_find (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_find (int result,
+ ATTRIBUTES &attr)
{
return this->implementation_->notify_find (result,
attr);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_unbind (int result,
+ const ATTRIBUTES &attr)
{
return this->implementation_->notify_unbind (result,
attr);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::notify_trybind (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_trybind (int result,
+ ATTRIBUTES &attr)
{
return this->implementation_->notify_trybind (result,
attr);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_rebind (int result,
+ const ATTRIBUTES &attr)
{
return this->implementation_->notify_rebind (result,
attr);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE int
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::clear_cache (CONTAINER &container)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE IMPLEMENTATION &
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::implementation (void)
{
- return this->implementation_->clear_cache (container);
+ return *this->implementation_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE IMPLEMENTATION &
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::implementation (void)
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE CACHING_UTILITY &
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::caching_utility (void)
{
- return *this->implementation_;
+ return this->implementation_->caching_utility ();
}
-
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY, class IMPLEMENTATION> ACE_INLINE void
-ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY, IMPLEMENTATION>::dump (void) const
+template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
+ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::dump (void) const
{
ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump");
@@ -120,42 +109,39 @@ ACE_Caching_Strategy_Adapter<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY
//////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE ATTRIBUTES
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::attributes (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return this->timer_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE double
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (double percentage)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
if (result == 0)
- {
- ++this->timer_;
- ++this->entries_;
- }
+ ++this->timer_;
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_find (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
+ ATTRIBUTES &attr)
{
if (result == 0)
{
@@ -166,26 +152,26 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
@@ -195,8 +181,14 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::dump (void) const
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
+{
+ return this->caching_utility_;
+}
+
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
ACE_TRACE ("ACE_LRU_Caching_Strategy::dump");
@@ -207,39 +199,36 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI
//////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE ATTRIBUTES
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::attributes (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return 0;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE double
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (double percentage)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
- if (result == 0)
- ++this->entries_;
-
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_find (int result,
- ATTRIBUTES &attr)
+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);
@@ -249,37 +238,40 @@ ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
- if (result == 0)
- ++this->entries_;
-
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::dump (void) const
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
+{
+ return this->caching_utility_;
+}
+
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
ACE_TRACE ("ACE_LFU_Caching_Strategy::dump");
@@ -289,84 +281,83 @@ ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI
//////////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE ATTRIBUTES
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::attributes (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return this->order_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE double
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return this->purge_percent_;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (double percentage)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
this->purge_percent_ = percentage;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
if (result == 0)
- {
- ++this->order_;
- ++this->entries_;
- }
+ ++this->order_;
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_find (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
if (result == 0)
- {
- ++this->order_;
- ++this->entries_;
- }
+ ++this->order_;
return result;
}
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
+{
+ return this->caching_utility_;
+}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::dump (void) const
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump");
@@ -377,71 +368,77 @@ ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT
//////////////////////////////////////////////////////////////////////////////////
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE ATTRIBUTES
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::attributes (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
{
return 0;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE double
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (void)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
{
return 0;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::purge_percent (double percentage)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
{
ACE_UNUSED_ARG (percentage);
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_find (int result,
- ATTRIBUTES &attr)
+
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
+ ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE int
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
+ const ATTRIBUTES &attr)
{
ACE_UNUSED_ARG (attr);
return result;
}
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
+{
+ return this->caching_utility_;
+}
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_INLINE void
-ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::dump (void) const
+template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
+ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
{
ACE_TRACE ("ACE_Null_Caching_Strategy::dump");
diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp
index 03a95809c22..47f2b34a362 100644
--- a/ace/Caching_Utility_T.cpp
+++ b/ace/Caching_Utility_T.cpp
@@ -9,7 +9,6 @@
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/Cleanup_Strategies_T.h"
#include "ace/Strategies.h"
#if !defined (__ACE_INLINE__)
@@ -20,9 +19,29 @@ ACE_RCSID(ace, Caching_Utility_T, "$Id$")
/////////////////////////////////////////////////////////////////////////////////////////////////////
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy,
+ int delete_cleanup_strategy)
+ : cleanup_strategy_ (cleanup_strategy),
+ delete_cleanup_strategy_ (delete_cleanup_strategy)
+{
+ if (cleanup_strategy == 0)
+ {
+ ACE_NEW (this->cleanup_strategy_,
+ CLEANUP_STRATEGY);
+ this->delete_cleanup_strategy_ = 1;
+ }
+}
+
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::~ACE_Pair_Caching_Utility (void)
+{
+ if (this->delete_cleanup_strategy_)
+ delete this->cleanup_strategy_;
+}
+
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> int
ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent)
{
// Check that the purge_percent is non-zero.
@@ -57,9 +76,9 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cac
if (key_to_remove == 0)
return 0;
- if (cleanup_s->cleanup (container,
- key_to_remove,
- value_to_remove) == -1)
+ if (this->cleanup_strategy_->cleanup (container,
+ key_to_remove,
+ value_to_remove) == -1)
return -1;
}
@@ -78,7 +97,7 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::minimum (
ATTRIBUTES min = (*iter).int_id_.second ();
key_to_remove = &(*iter).ext_id_;
value_to_remove = &(*iter).int_id_;
-
+
// The iterator moves thru the container searching for the entry
// with the lowest ATTRIBUTES.
for (++iter;
@@ -96,6 +115,71 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::minimum (
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy,
+ int delete_cleanup_strategy)
+ : cleanup_strategy_ (cleanup_strategy),
+ delete_cleanup_strategy_ (delete_cleanup_strategy)
+{
+ if (cleanup_strategy == 0)
+ {
+ ACE_NEW (this->cleanup_strategy_,
+ CLEANUP_STRATEGY);
+ this->delete_cleanup_strategy_ = 1;
+ }
+}
+
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::~ACE_Recyclable_Handler_Caching_Utility (void)
+{
+ if (this->delete_cleanup_strategy_)
+ delete this->cleanup_strategy_;
+}
+
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> int
+ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cache (CONTAINER &container,
+ double purge_percent)
+{
+ // Check that the purge_percent is non-zero.
+ if (purge_percent == 0)
+ return 0;
+
+ // Get the number of entries in the container.
+ size_t current_map_size = container.current_size ();
+
+ // Also whether the number of entries in the cache is just one!
+ // Oops! then there is no way out but exiting. So return an error.
+ if (current_map_size <= 1)
+ return 0;
+
+ // Calculate the no of entries to remove from the cache depending
+ // upon the <purge_percent>.
+ size_t entries_to_remove = size_t ((double (purge_percent) / 100 * current_map_size) + 0.5);
+
+ KEY *key_to_remove = 0;
+ VALUE *value_to_remove = 0;
+
+ for (size_t i = 0; i < entries_to_remove ; ++i)
+ {
+ this->minimum (container,
+ key_to_remove,
+ value_to_remove);
+
+ // Simply verifying that the key is non-zero.
+ // This is important for strategies where the minimum
+ // entry cant be found due to constraints on the type of entry
+ // to remove.
+ if (key_to_remove == 0)
+ return 0;
+
+ if (this->cleanup_strategy_->cleanup (container,
+ key_to_remove,
+ value_to_remove) == -1)
+ return -1;
+ }
+
+ return 0;
+}
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> void
ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::minimum (CONTAINER &container,
@@ -119,32 +203,55 @@ ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUT
{
// If the <min> entry isnt IDLE_AND_PURGABLE continue until you reach
// the first entry which can be purged. This is the minimum with
- // which you will compare the rest of the purgable entries.
+ // which you will compare the rest of the purgable entries.
if ((*iter).ext_id_.state () ==
ACE_Recyclable::IDLE_AND_PURGABLE)
{
if (found == 0)
{
min = (*iter).int_id_.second ();
+ key_to_remove = &(*iter).ext_id_;
+ value_to_remove = &(*iter).int_id_;
found = 1;
- }
- else
+ }
+ else
{
// Ah! an entry with lower ATTTRIBUTES...
if (min > (*iter).int_id_.second ())
- min = (*iter).int_id_.second ();
+ {
+ min = (*iter).int_id_.second ();
+ key_to_remove = &(*iter).ext_id_;
+ value_to_remove = &(*iter).int_id_;
+ }
}
- key_to_remove = &(*iter).ext_id_;
- value_to_remove = &(*iter).int_id_;
}
}
}
////////////////////////////////////////////////////////////////////////////////
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy,
+ int delete_cleanup_strategy)
+ : cleanup_strategy_ (cleanup_strategy),
+ delete_cleanup_strategy_ (delete_cleanup_strategy)
+{
+ if (cleanup_strategy == 0)
+ {
+ ACE_NEW (this->cleanup_strategy_,
+ CLEANUP_STRATEGY);
+ this->delete_cleanup_strategy_ = 1;
+ }
+}
+
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::~ACE_Handler_Caching_Utility (void)
+{
+ if (this->delete_cleanup_strategy_)
+ delete this->cleanup_strategy_;
+}
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> int
ACE_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent)
{
// Check that the purge_percent is non-zero.
@@ -172,9 +279,9 @@ ACE_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_
key_to_remove,
value_to_remove);
- if (cleanup_s->cleanup (container,
- key_to_remove,
- value_to_remove) == -1)
+ if (this->cleanup_strategy_->cleanup (container,
+ key_to_remove,
+ value_to_remove) == -1)
return -1;
}
@@ -212,13 +319,32 @@ ACE_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::minimu
////////////////////////////////////////////////////////////////////////////////////////////////////////
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Null_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::ACE_Null_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy,
+ int delete_cleanup_strategy)
+ : cleanup_strategy_ (cleanup_strategy),
+ delete_cleanup_strategy_ (delete_cleanup_strategy)
+{
+ if (cleanup_strategy == 0)
+ {
+ ACE_NEW (this->cleanup_strategy_,
+ CLEANUP_STRATEGY);
+ this->delete_cleanup_strategy_ = 1;
+ }
+}
+
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+ACE_Null_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::~ACE_Null_Caching_Utility (void)
+{
+ if (this->delete_cleanup_strategy_)
+ delete this->cleanup_strategy_;
+}
+
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> int
ACE_Null_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent)
{
ACE_UNUSED_ARG (container);
- ACE_UNUSED_ARG (cleanup_s);
ACE_UNUSED_ARG (purge_percent);
return 0;
diff --git a/ace/Caching_Utility_T.h b/ace/Caching_Utility_T.h
index 542aabff285..966bca32b9f 100644
--- a/ace/Caching_Utility_T.h
+++ b/ace/Caching_Utility_T.h
@@ -23,9 +23,7 @@
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
-// Forward declaration
-template <class KEY, class VALUE, class CONTAINER>
-class ACE_Cleanup_Strategy;
+#include "ace/Cleanup_Strategies_T.h"
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
class ACE_Pair_Caching_Utility
@@ -34,34 +32,52 @@ class ACE_Pair_Caching_Utility
// Defines a helper class for the Caching Strategies.
//
// = DESCRIPTION
- // This class defines the methods commonly used by the
- // different caching strategies. For instance: clear_cache ()
- // method which decides and purges the entry from the container.
- // Note: This class helps in the caching_strategies using a
- // container containing entries of <KEY, ACE_Pair<VALUE,
- // attributes>> kind. The attributes helps in deciding the
- // entries to be purged.
+ // This class defines the methods commonly used by the different
+ // caching strategies. For instance: clear_cache () method which
+ // decides and purges the entry from the container. Note: This
+ // class helps in the caching_strategies using a container
+ // containing entries of <KEY, ACE_Pair<VALUE, attributes>>
+ // kind. The attributes helps in deciding the entries to be
+ // purged. The Cleanup_Strategy is the callback class to which
+ // the entries to be cleaned up will be delegated.
public:
+ typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
+
+ ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
+ int delete_cleanup_strategy = 0);
+
+ // Constructor.
+
+ ~ACE_Pair_Caching_Utility (void);
+ // Destructor.
+
int clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent);
+
// Purge entries from the <container>. The Cleanup_Strategy will do
// the actual job of cleanup once the entries to be cleaned up are
// decided.
protected:
- virtual void minimum (CONTAINER &container,
- KEY *&key_to_remove,
- VALUE *&value_to_remove);
+ void minimum (CONTAINER &container,
+ KEY *&key_to_remove,
+ VALUE *&value_to_remove);
// Find the entry with minimum caching attributes.
+
+ CLEANUP_STRATEGY *cleanup_strategy_;
+ // The cleanup strategy which can be used to destroy the entries of
+ // the container.
+
+ int delete_cleanup_strategy_;
+ // Whether the cleanup_strategy should be destroyed or not.
};
////////////////////////////////////////////////////////////////////////////////
template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
-class ACE_Recyclable_Handler_Caching_Utility : public ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>
+class ACE_Recyclable_Handler_Caching_Utility
{
// = TITLE
// Defines a helper class for the Caching Strategies.
@@ -72,13 +88,42 @@ class ACE_Recyclable_Handler_Caching_Utility : public ACE_Pair_Caching_Utility<K
// decides and purges the entry from the container. Note: This
// class helps in the caching_strategies using a container
// containing entries of <KEY, Svc_Handler> kind. The attributes
- // helps in deciding the entries to be purged.
+ // helps in deciding the entries to be purged. The
+ // Cleanup_Strategy is the callback class to which the entries to
+ // be cleaned up will be delegated.
+
+public:
+
+ typedef ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
+ typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
+ ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
+ int delete_cleanup_strategy = 0);
+
+ // Constructor.
+
+ ~ACE_Recyclable_Handler_Caching_Utility (void);
+ // Destructor.
+
+ int clear_cache (CONTAINER &container,
+ double purge_percent);
+ // Purge entries from the <container>. The Cleanup_Strategy will do
+ // the actual job of cleanup once the entries to be cleaned up are
+ // decided.
+
protected:
- virtual void minimum (CONTAINER &container,
- KEY *&key_to_remove,
- VALUE *&value_to_remove);
+ void minimum (CONTAINER &container,
+ KEY *&key_to_remove,
+ VALUE *&value_to_remove);
// Find the entry with minimum caching attributes.
+
+ CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+ // This is the default Cleanup Strategy for this utility.
+
+ int delete_cleanup_strategy_;
+ // Whether the cleanup_strategy should be destroyed or not.
+
};
////////////////////////////////////////////////////////////////////////////////////////
@@ -90,17 +135,27 @@ class ACE_Handler_Caching_Utility
// Defines a helper class for the Caching Strategies.
//
// = DESCRIPTION
- // This class defines the methods commonly used by the
- // different caching strategies. For instance: clear_cache ()
- // method which decides and purges the entry from the container.
- // Note: This class helps in the caching_strategies using a
- // container containing entries of <KEY, HANDLER> kind where the
- // HANDLER contains the caching attributes which help in deciding
- // the entries to be purged.
+ // This class defines the methods commonly used by the different
+ // caching strategies. For instance: clear_cache () method which
+ // decides and purges the entry from the container. Note: This
+ // class helps in the caching_strategies using a container
+ // containing entries of <KEY, HANDLER> kind where the HANDLER
+ // contains the caching attributes which help in deciding the
+ // entries to be purged. The Cleanup_Strategy is the callback
+ // class to which the entries to be cleaned up will be delegated.
public:
+ typedef ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
+ typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
+ ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
+ int delete_cleanup_strategy = 0);
+ // Constructor.
+
+ ~ACE_Handler_Caching_Utility (void);
+ // Destructor.
+
int clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent);
// Purge entries from the <container>. The Cleanup_Strategy will do
// the actual job of cleanup once the entries to be cleaned up are
@@ -108,32 +163,51 @@ public:
protected:
- virtual void minimum (CONTAINER &container,
- KEY *&key_to_remove,
- VALUE *&value_to_remove);
+ void minimum (CONTAINER &container,
+ KEY *&key_to_remove,
+ VALUE *&value_to_remove);
// Find the entry with minimum caching attributes. This is handler
// specific since this utility is to be used very specifically for
// handler who have caching_attributes for server side acched
// connection management.
+
+ CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+ // The cleanup strategy which can be used to destroy the entries of
+ // the container.
+
+ int delete_cleanup_strategy_;
+ // Whether the cleanup_strategy should be destroyed or not.
+
};
///////////////////////////////////////////////////////////////////////////
-template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
+template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
class ACE_Null_Caching_Utility
{
// = TITLE
// Defines a dummy helper class for the Caching Strategies.
//
// = DESCRIPTION
- // This class defines the methods commonly used by the
- // different caching strategies. For instance: clear_cache ()
- // method which decides and purges the entry from the container.
- // Note: This class is be used with the Null_Caching_Strategy.
+ // This class defines the methods commonly used by the different
+ // caching strategies. For instance: clear_cache () method which
+ // decides and purges the entry from the container. Note: This
+ // class is be used with the Null_Caching_Strategy. The
+ // Cleanup_Strategy is the callback class to which the entries to
+ // be cleaned up will be delegated.
public:
+ typedef ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
+ typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
+
+ ACE_Null_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
+ int delete_cleanup_strategy = 0);
+ // Constructor.
+
+ ~ACE_Null_Caching_Utility (void);
+ // Destructor.
+
int clear_cache (CONTAINER &container,
- ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
double purge_percent);
// Purge entries from the <container>. The Cleanup_Strategy will do
// the actual job of cleanup once the entries to be cleaned up are
@@ -141,13 +215,20 @@ public:
protected:
- virtual void minimum (CONTAINER &container,
- KEY *&key_to_remove,
- VALUE *&value_to_remove);
+ void minimum (CONTAINER &container,
+ KEY *&key_to_remove,
+ VALUE *&value_to_remove);
// Find the entry with minimum caching attributes. This is handler
// specific since this utility is to be used very specifically for
// handler who have caching_attributes for server side acched
// connection management.Note: Here it is a no-op.
+
+ CLEANUP_STRATEGY_BASE *cleanup_strategy_;
+ // The cleanup strategy which can be used to destroy the entries of
+ // the container.
+
+ int delete_cleanup_strategy_;
+ // Whether the cleanup_strategy should be destroyed or not.
};
///////////////////////////////////////////////////////////////////////////
diff --git a/ace/Cleanup_Strategies_T.cpp b/ace/Cleanup_Strategies_T.cpp
index b54db63adf3..31be58692a0 100644
--- a/ace/Cleanup_Strategies_T.cpp
+++ b/ace/Cleanup_Strategies_T.cpp
@@ -17,17 +17,12 @@
ACE_RCSID(ace, Cleanup_Strategies_T, "$Id$")
-template <class KEY, class VALUE, class CONTAINER>
-ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::~ACE_Cleanup_Strategy (void)
-{
-}
-
////////////////////////////////////////////////////////////////////////////
template <class KEY, class VALUE, class CONTAINER> int
-ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
- KEY *key,
- VALUE *value)
+ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
+ KEY *key,
+ VALUE *value)
{
ACE_UNUSED_ARG (value);
@@ -37,24 +32,25 @@ ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &contain
////////////////////////////////////////////////////////////////////////////
template <class KEY, class VALUE, class CONTAINER> int
-ACE_Svc_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
- KEY *key,
+ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
+ KEY *key,
VALUE *value)
{
- (value->first ())->recycler (0, 0);
+ value->first ()->recycler (0, 0);
+
+ value->first ()->close ();
- (value->first ())->close ();
-
if (container.unbind (*key) == -1)
return -1;
-
- return 0;
+
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class CONTAINER> int
-ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
- KEY *key,
+ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
+ KEY *key,
VALUE *value)
{
// Remove the item from cache only if the handler isnt in use.
@@ -68,16 +64,15 @@ ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &contain
}
return 0;
-
}
////////////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class CONTAINER> int
-ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
- KEY *key,
+ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
+ KEY *key,
VALUE *value)
{
-
ACE_UNUSED_ARG (container);
ACE_UNUSED_ARG (key);
ACE_UNUSED_ARG (value);
diff --git a/ace/Cleanup_Strategies_T.h b/ace/Cleanup_Strategies_T.h
index 6c266ffc1c5..15c615a9d09 100644
--- a/ace/Cleanup_Strategies_T.h
+++ b/ace/Cleanup_Strategies_T.h
@@ -27,51 +27,23 @@ template <class KEY, class VALUE, class CONTAINER>
class ACE_Cleanup_Strategy
{
// = TITLE
- // Defines a abstract base class which takes care of winding up
- // and destroying the entries in the container.
- //
- // = DESCRIPTION
- // This class is one of the ways to ensure that the cleanup
- // can be decoupled from other strategies which need to do it.
- // The cleanup method provided needs to be implemented as needed.
-
- public:
-
- // = Termination.
-
- virtual ~ACE_Cleanup_Strategy (void);
-
- // = The cleanup operation.
-
- virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value) = 0;
- // This pure virtual method is to be used to destroy the <KEY,
- // VALUE> entry.
-
-};
-
-//////////////////////////////////////////////////////////////////////////
-
-template <class KEY, class VALUE, class CONTAINER>
-class ACE_Default_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
-{
- // = TITLE
// Defines a default strategy to be followed for cleaning up
// entries from a map which is the container.
//
// = DESCRIPTION
- // By defualt the entry to be cleaned up is removed from the
+ // By default the entry to be cleaned up is removed from the
// container.
public:
-
+
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
// The method which will do the cleanup of the entry in the container.
-
};
//////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class CONTAINER>
-class ACE_Svc_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
+class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
// = TITLE
// Defines a strategy to be followed for cleaning up
@@ -84,19 +56,19 @@ class ACE_Svc_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAIN
// the handler is recyclable.
public:
-
+
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
// The method which will do the cleanup of the entry in the container.
-
};
//////////////////////////////////////////////////////////////////////
+
template <class KEY, class VALUE, class CONTAINER>
class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
// = TITLE
// Defines a strategy to be followed for cleaning up
- // entries which are svc_handlers from a container.
+ // entries which are svc_handlers from a container.
//
// = DESCRIPTION
// The entry to be cleaned up is removed from the container.
@@ -106,15 +78,13 @@ class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CON
// attributes.
public:
-
+
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
// The method which will do the cleanup of the entry in the container.
-
};
//////////////////////////////////////////////////////////////////////
-
template <class KEY, class VALUE, class CONTAINER>
class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
@@ -126,10 +96,9 @@ class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAI
// the effect of the Cleanup Strategy.
public:
-
+
virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
// The dummy cleanup method.
-
};
#if defined (__ACE_INLINE__)
diff --git a/ace/Hash_Cache_Map_Manager_T.cpp b/ace/Hash_Cache_Map_Manager_T.cpp
index 9abe0de904d..57dde184a04 100644
--- a/ace/Hash_Cache_Map_Manager_T.cpp
+++ b/ace/Hash_Cache_Map_Manager_T.cpp
@@ -22,7 +22,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Cache_Map_Manager)
#define T_1 class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES
#define T_2 KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES
- template <T_1>
+template <T_1>
ACE_Hash_Cache_Map_Manager<T_2>::ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
size_t size,
ACE_Allocator *alloc)
diff --git a/ace/Hash_Cache_Map_Manager_T.h b/ace/Hash_Cache_Map_Manager_T.h
index cae1929c0c9..27391876765 100644
--- a/ace/Hash_Cache_Map_Manager_T.h
+++ b/ace/Hash_Cache_Map_Manager_T.h
@@ -27,12 +27,26 @@
// Forward declaration.
class ACE_Allocator;
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+#define ACE_CACHE_MAP_MANAGER \
+ ACE_Cache_Map_Manager<KEY, \
+ VALUE, \
+ ACE_Hash_Map_Manager_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \
+ ACE_Hash_Map_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \
+ ACE_Hash_Map_Reverse_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \
+ CACHING_STRATEGY, \
+ ATTRIBUTES>
+#else
+#define ACE_CACHE_MAP_MANAGER \
+ ACE_Cache_Map_Manager<KEY, \
+ VALUE, \
+ ACE_Hash_Map_Manager_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>, \
+ CACHING_STRATEGY, \
+ ATTRIBUTES>
+#endif (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+
template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES>
-class ACE_Hash_Cache_Map_Manager : public ACE_Cache_Map_Manager< KEY, VALUE,
- ACE_Hash_Map_Manager_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- ACE_Hash_Map_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- ACE_Hash_Map_Reverse_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- CACHING_STRATEGY, ATTRIBUTES>
+class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER
{
// = TITLE
// Defines a abstraction which will purge entries from a map.
@@ -160,12 +174,7 @@ class ACE_Hash_Cache_Map_Manager : public ACE_Cache_Map_Manager< KEY, VALUE,
protected:
- typedef ACE_Cache_Map_Manager<KEY, VALUE,
- ACE_Hash_Map_Manager_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- ACE_Hash_Map_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- ACE_Hash_Map_Reverse_Iterator_Ex<KEY, ACE_Pair<VALUE, ATTRIBUTES>, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>,
- CACHING_STRATEGY, ATTRIBUTES>
- ACE_HCMM_BASE;
+ typedef ACE_CACHE_MAP_MANAGER ACE_HCMM_BASE;
// Base class.
};
diff --git a/tests/Cache_Map_Manager_Test.cpp b/tests/Cache_Map_Manager_Test.cpp
index c6c15c5870c..242ac972d44 100644
--- a/tests/Cache_Map_Manager_Test.cpp
+++ b/tests/Cache_Map_Manager_Test.cpp
@@ -50,13 +50,21 @@ typedef ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, A
HASH_MAP_MANAGER;
typedef ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>
HASH_MAP_ITERATOR;
+typedef ACE_Hash_Map_Reverse_Iterator_Ex<KEY, CACHE_VALUE, Hash_Key, ACE_Equal_To<KEY>, ACE_Null_Mutex>
+ HASH_MAP_REVERSE_ITERATOR;
typedef ACE_Map_Manager<KEY, CACHE_VALUE, ACE_Null_Mutex>
MAP_MANAGER;
typedef ACE_Map_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex>
MAP_ITERATOR;
typedef ACE_Map_Reverse_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex>
- MAP_REV_ITERATOR;
+ MAP_REVERSE_ITERATOR;
+
+typedef ACE_Cleanup_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER>
+ HASH_MAP_CLEANUP;
+
+typedef ACE_Cleanup_Strategy<KEY, CACHE_VALUE, MAP_MANAGER>
+ MAP_CLEANUP;
typedef ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_ITERATOR, ATTR>
HASH_MAP_CACHING_UTILITY;
@@ -65,48 +73,48 @@ typedef ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_ITERATOR, AT
MAP_CACHING_UTILITY;
// = Hash_Map_Manager related
-typedef ACE_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
+typedef ACE_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
HASH_MAP_CACHING_STRATEGY;
-typedef ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
+typedef ACE_LRU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
HASH_MAP_LRU;
-typedef ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
+typedef ACE_LFU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
HASH_MAP_LFU;
-typedef ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
+typedef ACE_FIFO_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
HASH_MAP_FIFO;
-typedef ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
+typedef ACE_Null_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
HASH_MAP_NULL;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>
+typedef ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>
HASH_MAP_LRU_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>
+typedef ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>
HASH_MAP_LFU_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>
+typedef ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>
HASH_MAP_FIFO_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>
+typedef ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>
HASH_MAP_NULL_ADAPTER;
// = Map_Manager related
-typedef ACE_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
+typedef ACE_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
MAP_CACHING_STRATEGY;
-typedef ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
+typedef ACE_LRU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
MAP_LRU;
-typedef ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
+typedef ACE_LFU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
MAP_LFU;
-typedef ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
+typedef ACE_FIFO_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
MAP_FIFO;
-typedef ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
+typedef ACE_Null_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
MAP_NULL;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LRU>
+typedef ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LRU>
MAP_LRU_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LFU>
+typedef ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LFU>
MAP_LFU_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_FIFO>
+typedef ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_FIFO>
MAP_FIFO_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_NULL>
+typedef ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_NULL>
MAP_NULL_ADAPTER;
typedef ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR>
HASH_MAP_CACHE;
-typedef ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_ITERATOR, MAP_REV_ITERATOR, MAP_CACHING_STRATEGY, ATTR>
+typedef ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_ITERATOR, MAP_REVERSE_ITERATOR, MAP_CACHING_STRATEGY, ATTR>
MAP_CACHE;
enum Caching_Strategy_Type
@@ -456,7 +464,7 @@ test_caching_strategy_type (void)
ACE_NEW (hash_map_caching_strategy,
HASH_MAP_FIFO_ADAPTER);
break;
-
+
case ACE_ALL: // Just to remove warnings!
break;
}
@@ -613,42 +621,39 @@ template class ACE_Map_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex>;
template class ACE_Map_Reverse_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex>;
template class ACE_Map_Entry<KEY, CACHE_VALUE>;
-template class ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, ATTR>;
-template class ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_MANAGER::iterator, ATTR>;
-
-template class ACE_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>;
-template class ACE_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>;
-template class ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>;
-template class ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>;
-template class ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>;
-template class ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>;
-template class ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>;
-template class ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>;
-template class ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>;
-template class ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>;
-
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LRU>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LFU>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_FIFO>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>;
-template class ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_NULL>;
-
-template class ACE_Default_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, HASH_MAP_MANAGER>;
-template class ACE_Default_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, MAP_MANAGER>;
-
-template class ACE_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, HASH_MAP_MANAGER>;
-template class ACE_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, MAP_MANAGER>;
-
-template class ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_MANAGER::iterator, MAP_MANAGER::reverse_iterator, MAP_CACHING_STRATEGY, ATTR>;
-template class ACE_Cache_Map_Iterator<KEY, VALUE, MAP_MANAGER::iterator, MAP_CACHING_STRATEGY, ATTR>;
-template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, MAP_MANAGER::reverse_iterator, MAP_CACHING_STRATEGY, ATTR>;
-
-template class ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>;
-template class ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_MANAGER::iterator, HASH_MAP_CACHING_STRATEGY, ATTR>;
-template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>;
+template class ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_ITERATOR, ATTR>;
+template class ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_ITERATOR, ATTR>;
+
+template class ACE_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>;
+template class ACE_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>;
+template class ACE_LRU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>;
+template class ACE_LRU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>;
+template class ACE_LFU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>;
+template class ACE_LFU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>;
+template class ACE_FIFO_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>;
+template class ACE_FIFO_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>;
+template class ACE_Null_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>;
+template class ACE_Null_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>;
+
+template class ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>;
+template class ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LRU>;
+template class ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>;
+template class ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LFU>;
+template class ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>;
+template class ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_FIFO>;
+template class ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>;
+template class ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_NULL>;
+
+template class ACE_Cleanup_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER>;
+template class ACE_Cleanup_Strategy<KEY, CACHE_VALUE, MAP_MANAGER>;
+
+template class ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_ITERATOR, MAP_REVERSE_ITERATOR, MAP_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Iterator<KEY, VALUE, MAP_ITERATOR, MAP_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, MAP_REVERSE_ITERATOR, MAP_CACHING_STRATEGY, ATTR>;
+
+template class ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_ITERATOR, HASH_MAP_REVERSE_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_REVERSE_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>;
template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -669,42 +674,39 @@ template class ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY
#pragma instantiate ACE_Map_Reverse_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex>
#pragma instantiate ACE_Map_Entry<KEY, CACHE_VALUE>
-#pragma instantiate ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, ATTR>
-#pragma instantiate ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_MANAGER::iterator, ATTR>
-
-#pragma instantiate ACE_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
-#pragma instantiate ACE_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
-#pragma instantiate ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
-#pragma instantiate ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
-#pragma instantiate ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
-#pragma instantiate ACE_LFU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
-#pragma instantiate ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
-#pragma instantiate ACE_FIFO_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
-#pragma instantiate ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY>
-#pragma instantiate ACE_Null_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY>
-
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LRU>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_LFU>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_FIFO>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>
-#pragma instantiate ACE_Caching_Strategy_Adapter<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY, MAP_NULL>
-
-#pragma instantiate ACE_Default_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, HASH_MAP_MANAGER>
-#pragma instantiate ACE_Default_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, MAP_MANAGER>
-
-#pragma instantiate ACE_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, HASH_MAP_MANAGER>
-#pragma instantiate ACE_Cleanup_Strategy<KEY, ACE_Pair<KEY, ATTR>, MAP_MANAGER>
-
-#pragma instantiate ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_MANAGER::iterator, MAP_MANAGER::reverse_iterator, MAP_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Iterator<KEY, VALUE, MAP_MANAGER::iterator, MAP_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, MAP_MANAGER::reverse_iterator, MAP_CACHING_STRATEGY, ATTR>
-
-#pragma instantiate ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER::iterator, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_MANAGER::iterator, HASH_MAP_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_MANAGER::reverse_iterator, HASH_MAP_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_ITERATOR, ATTR>
+#pragma instantiate ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_ITERATOR, ATTR>
+
+#pragma instantiate ACE_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
+#pragma instantiate ACE_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
+#pragma instantiate ACE_LRU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
+#pragma instantiate ACE_LRU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
+#pragma instantiate ACE_LFU_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
+#pragma instantiate ACE_LFU_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
+#pragma instantiate ACE_FIFO_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
+#pragma instantiate ACE_FIFO_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
+#pragma instantiate ACE_Null_Caching_Strategy<ATTR, HASH_MAP_CACHING_UTILITY>
+#pragma instantiate ACE_Null_Caching_Strategy<ATTR, MAP_CACHING_UTILITY>
+
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LRU>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LRU>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_LFU>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_LFU>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_FIFO>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_FIFO>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, HASH_MAP_CACHING_UTILITY, HASH_MAP_NULL>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTR, MAP_CACHING_UTILITY, MAP_NULL>
+
+#pragma instantiate ACE_Cleanup_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER>
+#pragma instantiate ACE_Cleanup_Strategy<KEY, CACHE_VALUE, MAP_MANAGER>
+
+#pragma instantiate ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_ITERATOR, MAP_REVERSE_ITERATOR, MAP_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Iterator<KEY, VALUE, MAP_ITERATOR, MAP_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, MAP_REVERSE_ITERATOR, MAP_CACHING_STRATEGY, ATTR>
+
+#pragma instantiate ACE_Cache_Map_Manager<KEY, VALUE, HASH_MAP_MANAGER, HASH_MAP_ITERATOR, HASH_MAP_REVERSE_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Iterator<KEY, VALUE, HASH_MAP_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, HASH_MAP_REVERSE_ITERATOR, HASH_MAP_CACHING_STRATEGY, ATTR>
#pragma instantiate ACE_Hash_Cache_Map_Manager<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, HASH_MAP_CACHING_STRATEGY, ATTR>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/tests/Cached_Conn_Test.cpp b/tests/Cached_Conn_Test.cpp
index 39ffc3f235f..799e5f9831e 100644
--- a/tests/Cached_Conn_Test.cpp
+++ b/tests/Cached_Conn_Test.cpp
@@ -9,11 +9,11 @@
// Cached_Conn_Test.cpp
//
// = DESCRIPTION
-// The test illustrates how the <ACE_Strategy_Connector> works by
-// showing how you can cache connections on the client using
-// different caching strategies. Also how connections can be purged
-// explicitly if needed from the connection cache maintained by the
-// connector.
+// The test illustrates how the <ACE_Strategy_Connector> works by
+// showing how you can cache connections on the client using
+// different caching strategies. Also how connections can be purged
+// explicitly and implicitly if needed from the connection cache
+// maintained by the connector.
//
// = AUTHOR
// Kirthika Parameswaran <kirthika@cs.wustl.edu>
@@ -24,9 +24,13 @@
#define CACHED_CONNECT_TEST
#include "test_config.h"
+
+#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8
+#define ACE_HAS_BROKEN_EXTENDED_TEMPLATES
+#endif /* __GNUC__ */
+
#include "ace/INET_Addr.h"
#include "ace/Strategies.h"
-#include "ace/Auto_Ptr.h"
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Acceptor.h"
#include "ace/Svc_Handler.h"
@@ -37,6 +41,10 @@
#include "ace/Caching_Utility_T.h"
#include "ace/Cached_Connect_Strategy_T.h"
+#if defined(_MSC_VER)
+#pragma warning(disable:4503)
+#endif /* _MSC_VER */
+
ACE_RCSID(tests, Cached_Conn_Test, "$Id$")
#if defined(__BORLANDC__) && __BORLANDC__ >= 0x0530
@@ -44,150 +52,156 @@ USELIB("..\ace\aced.lib");
//---------------------------------------------------------------------------
#endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */
-// Default number of clients/servers.
-static int n_servers = 3000;
-static double purge_percentage = 20;
-
-enum Caching_Strategy_Type
-{
- ACE_LFU,
- ACE_FIFO,
- ACE_LRU,
- ACE_NULL,
- ACE_ALL
-};
-static Caching_Strategy_Type caching_strategy_type = ACE_ALL;
+static int debug = 0;
class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
{
-
public:
Svc_Handler (ACE_Thread_Manager *t = 0)
: ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> (t)
{
}
-
+
int open (void *v = 0)
{
- ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::open (v);
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) opening Svc_Handler %d with handle %d\n"),
- this,
- this->peer ().get_handle ()));
+ ACE_UNUSED_ARG (v);
+ if (debug)
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("opening Svc_Handler %d with handle %d\n"),
+ this,
+ this->peer ().get_handle ()));
return 0;
}
-
- int close (u_long flags = 0)
- {
- ACE_UNUSED_ARG (flags);
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) Closing Svc_Handler %d with handle %d\n"),
- this,
- this->peer ().get_handle ()));
- return this->handle_close ();
- }
- int idle (u_long flags = 0)
+ int close (u_long flags = 0)
{
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) idling Svc_Handler %d with handle %d\n"),
+ ASYS_TEXT ("Closing Svc_Handler %d with handle %d\n"),
this,
this->peer ().get_handle ()));
- return ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::idle (flags);
+ return ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::close (flags);
}
-
};
typedef size_t ATTRIBUTES;
-typedef ACE_Pair<Svc_Handler *, ATTRIBUTES>
+typedef ACE_Pair<Svc_Handler *, ATTRIBUTES>
CACHED_HANDLER;
typedef ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr>
- REFCOUNTED_HASH_RECYCLABLE_ADDR;
-typedef ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR> H_KEY;
-typedef ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR> C_KEYS;
+ ADDR;
+typedef ACE_Hash<ADDR> H_KEY;
+typedef ACE_Equal_To<ADDR> C_KEYS;
-typedef ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>,\
- ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>
+typedef ACE_Hash_Map_Manager_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
HASH_MAP;
-typedef ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, \
- ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>
+typedef ACE_Hash_Map_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
HASH_MAP_ITERATOR;
-typedef ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>,\
- ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>
+typedef ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
HASH_MAP_REVERSE_ITERATOR;
-typedef ACE_Svc_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>
+typedef ACE_Recyclable_Handler_Cleanup_Strategy<ADDR, CACHED_HANDLER, HASH_MAP>
CLEANUP_STRATEGY;
-typedef ACE_Recyclable_Handler_Caching_Utility<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP_ITERATOR, ATTRIBUTES>
+typedef ACE_Recyclable_Handler_Caching_Utility<ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP_ITERATOR, ATTRIBUTES>
CACHING_UTILITY;
-typedef ACE_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
+typedef ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
CACHING_STRATEGY;
-typedef ACE_LRU_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
+typedef ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
LRU_CACHING_STRATEGY;
-typedef ACE_LFU_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
+typedef ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
LFU_CACHING_STRATEGY;
-typedef ACE_FIFO_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
+typedef ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
FIFO_CACHING_STRATEGY;
-typedef ACE_Null_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
+typedef ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
NULL_CACHING_STRATEGY;
-typedef ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY >
+typedef ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY >
LRU_CACHING_STRATEGY_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY>
+typedef ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY>
LFU_CACHING_STRATEGY_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY>
+typedef ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY>
FIFO_CACHING_STRATEGY_ADAPTER;
-typedef ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY>
+typedef ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY>
NULL_CACHING_STRATEGY_ADAPTER;
typedef ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR>
ACCEPTOR;
-
+
typedef ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>
STRATEGY_CONNECTOR;
-
+
typedef ACE_NOOP_Creation_Strategy<Svc_Handler>
NULL_CREATION_STRATEGY;
-
+
typedef ACE_NOOP_Concurrency_Strategy<Svc_Handler>
NULL_ACTIVATION_STRATEGY;
-
+
typedef ACE_Cached_Connect_Strategy_Ex<Svc_Handler, ACE_SOCK_CONNECTOR, CACHING_STRATEGY, ATTRIBUTES, ACE_SYNCH_NULL_MUTEX>
CACHED_CONNECT_STRATEGY;
+enum Caching_Strategy_Type
+{
+ ACE_LFU,
+ ACE_FIFO,
+ ACE_LRU,
+ ACE_NULL,
+ ACE_ALL
+};
+
+// Default number of clients/servers.
+static int default_iterations = 3000;
+static int iterations = default_iterations;
+static double purge_percentage = 20;
+static Caching_Strategy_Type caching_strategy_type = ACE_ALL;
+static CACHED_CONNECT_STRATEGY *connect_strategy = 0;
+
//====================================================================
+static void
+out_of_sockets_handler (void)
+{
+ // ENOBUFS had to be checked on NT while ENOENT check had to be added for
+ // Solaris + Linux.
+ if (errno == EMFILE || errno == ENOBUFS || errno == ENOENT)
+ {
+ // Close connections which are cached by explicitly purging the
+ // connection cache maintained by the connector.
+ ACE_DEBUG ((LM_DEBUG, "Purging connections from Connection Cache...\n"));
+
+ int retval = connect_strategy->purge_connections (purge_percentage);
+ ACE_ASSERT (retval != -1);
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("out_of_sockets_handler failed!")));
+ // This shouldn't happen!
+ ACE_ASSERT (0);
+ }
+}
static int
cached_connect (STRATEGY_CONNECTOR &con,
const ACE_INET_Addr &server_addr)
{
- Svc_Handler *svc_handler = 0;
-
+ // This will make sure we get the host information correct.
+ ACE_INET_Addr remote_addr (server_addr.get_port_number (),
+ ACE_DEFAULT_SERVER_HOST);
+
// Perform a blocking connect to the server using the Strategy
- // Connector with a connection caching strategy. Since we are
- // connecting to the same <server_addr> these calls will return
- // the same dynamically allocated <Svc_Handler> for each
- // <connect>.
+ // Connector with a connection caching strategy.
+ Svc_Handler *svc_handler = 0;
int result = con.connect (svc_handler,
- server_addr);
+ remote_addr);
if (result == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
+ ASYS_TEXT ("%p\n"),
ASYS_TEXT ("connection failed")),
-1);
-
- // Send the data to the server.
- for (char *c = ACE_ALPHABET; *c != '\0'; c++)
- if (svc_handler->peer ().send_n (c, 1) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("send_n")),
- -1);
-
+
// Svc_Handler is now idle, so mark it as such and let the cache
// recycle it.
svc_handler->idle (1);
+
return 0;
}
@@ -195,133 +209,88 @@ static int
server (ACCEPTOR *acceptor)
{
ACE_INET_Addr cli_addr;
-
+
// Create a new <Svc_Handler> to consume the data.
Svc_Handler svc_handler;
-
+
int result = acceptor->accept (&svc_handler,
&cli_addr);
if (result == -1)
- {
- if (errno == EMFILE)
- return 1;
-
- return -1;
- }
+ return -1;
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) client %s connected from %d\n"),
- cli_addr.get_host_name (),
- cli_addr.get_port_number ()));
-
- char c;
- char *t = ACE_ALPHABET;
- ssize_t r_bytes = 0;
-
- // Read data from client (terminate on error).
- while ((r_bytes == svc_handler.peer ().recv_n (&c, 1)) > 0)
- {
- ACE_ASSERT (*t == c);
-
- // We need to guard against cached connections, which
- // will send multiple sequences of letters from 'a' ->
- // 'z' through the same connection.
- if (*t == 'z')
- t = ACE_ALPHABET;
- else
- t++;
- }
-
- if (r_bytes == 0)
+ if (debug)
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) reached end of input, connection closed by client\n")));
- else if (r_bytes == -1)
- {
- if (errno == EWOULDBLOCK)
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) no input available, going back to reading\n")));
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("recv_n")),
- -1);
- }
+ ASYS_TEXT ("client %s connected from %d\n"),
+ cli_addr.get_host_name (),
+ cli_addr.get_port_number ()));
+ //
+ // Svc_Handler dies here, closing the server side socket.
+ //
return 0;
}
-
static void
test_connection_management (CACHING_STRATEGY &caching_strategy)
{
- NULL_CREATION_STRATEGY creation_strategy;
- NULL_ACTIVATION_STRATEGY activation_strategy;
-
// Configure the Strategy Connector with a strategy that caches
// connection.
CACHED_CONNECT_STRATEGY caching_connect_strategy (caching_strategy);
-
+
+ // This is required by the <out_of_sockets_handler>.
+ connect_strategy = &caching_connect_strategy;
+
+ NULL_CREATION_STRATEGY creation_strategy;
+ NULL_ACTIVATION_STRATEGY activation_strategy;
+
STRATEGY_CONNECTOR strategy_connector (0,
&creation_strategy,
&caching_connect_strategy,
&activation_strategy);
-
- // Set the purging percentage explicitly. By default it is 10%.
- // Note: The purge_percent could have been set before itself but,
- // the following has been done just to show how one would explicitly
- // set the purge_percent at any moment.
- CACHED_CONNECT_STRATEGY *connect_strategy =
- ACE_dynamic_cast (CACHED_CONNECT_STRATEGY *,
- strategy_connector.connect_strategy ());
-
- connect_strategy->caching_strategy ().purge_percent (purge_percentage);
-
- for (int i = 0; i < n_servers; ++i)
+
+ for (int i = 0; i < iterations; ++i)
{
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("iteration %d\n"),
+ i));
+
// Acceptor
ACCEPTOR acceptor;
ACE_INET_Addr server_addr;
-
+
// Bind acceptor to any port and then find out what the port
// was.
- if (acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &)) == -1
- || acceptor.acceptor ().get_local_addr (server_addr) == -1)
+
+ if (acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &)) == -1)
{
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("open")));
- return;
+ out_of_sockets_handler ();
+ continue;
}
- else
+
+ if (acceptor.acceptor ().get_local_addr (server_addr) == -1)
{
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) starting server at port %d\n"),
- server_addr.get_port_number ()));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("open")));
+ ACE_ASSERT (0);
}
-
+
+ if (debug)
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("starting server at port %d\n"),
+ server_addr.get_port_number ()));
+
// Run the cached blocking test.
- ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("(%P|%t) *starting cached blocking connect\n")));
-
int result = cached_connect (strategy_connector,
server_addr);
ACE_ASSERT (result != -1);
-
+
result = server (&acceptor);
- if (result == 1)
- {
- // Close connections which are cached by explicitly purging
- // the connection cache maintained by the connector.
- ACE_DEBUG ((LM_DEBUG, "Purging connections from Connection Cache...\n"));
-
- int retval = connect_strategy->purge_connections (purge_percentage);
- ACE_ASSERT (retval != -1);
- }
-
- ACE_ASSERT (result != -1);
- }
+ if (result == -1)
+ out_of_sockets_handler ();
+ }
}
-
+
void
test_caching_strategy_type (void)
{
@@ -352,11 +321,12 @@ test_caching_strategy_type (void)
ACE_NEW (caching_strategy,
FIFO_CACHING_STRATEGY_ADAPTER);
break;
-
+
case ACE_ALL: // Just to remove warnings!
break;
- }
+ }
+ caching_strategy->purge_percent (purge_percentage);
test_connection_management (*caching_strategy);
delete caching_strategy;
}
@@ -365,20 +335,26 @@ test_caching_strategy_type (void)
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opt (argc, argv, "s:p:c:");
-
+ ACE_Get_Opt get_opt (argc, argv, "i:p:c:d");
+
int cc;
-
+
while ((cc = get_opt ()) != -1)
switch (cc)
{
- case 's':
- n_servers = atoi (get_opt.optarg);
+ case 'd':
+ debug = 1;
+ break;
+ case 'i':
+ iterations = atoi (get_opt.optarg);
break;
case 'p':
purge_percentage = atoi (get_opt.optarg);
break;
- case 'c': // If Null Caching Strategy then this test will fail!
+ case 'c':
+ // Note that if null caching strategy is used then this test
+ // will fail if the number of servers exceed number of open
+ // files allowed for the process.
if (ACE_OS::strcmp (get_opt.optarg, "null") == 0)
caching_strategy_type = ACE_NULL;
if (ACE_OS::strcmp (get_opt.optarg, "lru") == 0)
@@ -392,10 +368,11 @@ parse_args (int argc, char *argv[])
case 'h':
default:
ACE_ERROR ((LM_ERROR,
- "usage: %s "
- "[-s (number of servers to connect to)] "
- "[-p (purge percent)] "
- "[-c (caching_strategy_type 0=NULL , 1=LRU, 2=LFU, 3=FIFO default=LRU)]\n",
+ ASYS_TEXT ("usage: %s ")
+ ASYS_TEXT ("[-c (caching strategy: lru / lfu / fifo / null [default = all])] ")
+ ASYS_TEXT ("[-i (iterations)] ")
+ ASYS_TEXT ("[-d (addition debugging output)] ")
+ ASYS_TEXT ("[-p (purge percent)] "),
argv[0]));
return -1;
}
@@ -407,21 +384,29 @@ int
main (int argc,
ASYS_TCHAR *argv[])
{
+ // Validate options.
+ int result = parse_args (argc, argv);
+ if (result != 0)
+ return result;
+
+ // Start the test only if options are valid.
ACE_START_TEST (ASYS_TEXT ("Cached_Conn_Test"));
+
+ // Remove the extra debugging attributes from Log_Msg output.
ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE);
-
- // Obtain the <number of servers> to connect to. Also the purge
- // percentage using which the entries in the connection cache of
- // the connector will be removed.
- int result = parse_args (argc, argv);
- ACE_ASSERT (result == 0);
- // Do we need to test all the strategies.
+ // Do we need to test all the strategies. Note, that the less
+ // useful null strategy is ignored in this case.
if (caching_strategy_type == ACE_ALL)
{
caching_strategy_type = ACE_LRU;
test_caching_strategy_type ();
+ // Default iterations are too many; we the user hasn't specified
+ // otherwise, we'll shrink the iterations for LFU and FIFO.
+ if (iterations == default_iterations)
+ iterations = default_iterations / 100;
+
caching_strategy_type = ACE_LFU;
test_caching_strategy_type ();
@@ -432,7 +417,7 @@ main (int argc,
{
test_caching_strategy_type ();
}
-
+
ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE);
ACE_END_TEST;
return 0;
@@ -448,16 +433,16 @@ template class ACE_Concurrency_Strategy<Svc_Handler>;
template class ACE_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR>;
template class ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>;
template class ACE_Creation_Strategy<Svc_Handler>;
-template class ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *>;
-template class ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>;
-template class ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>;
-template class ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, C_KEYS, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, C_KEYS, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, C_KEYS, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, C_KEYS, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Entry<ADDR, Svc_Handler *>;
+template class ACE_Hash<ADDR>;
+template class ACE_Equal_To<ADDR>;
+template class ACE_Hash_Map_Manager<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Manager_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Iterator<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>;
template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>;
template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>;
template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>;
@@ -470,49 +455,53 @@ template class ACE_Svc_Tuple<Svc_Handler>;
template class ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR>;
template class ACE_Pair<Svc_Handler *, ATTRIBUTES>;
-template class ACE_Reference_Pair<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *>;
-template class ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER>;
-
-template class ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
-
-template class ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Reference_Pair<ADDR, Svc_Handler *>;
+template class ACE_Hash_Map_Entry<ADDR, CACHED_HANDLER>;
+
+template class ACE_Hash_Map_Manager<ADDR, Svc_Handler *, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator<ADDR, Svc_Handler *, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator<ADDR, Svc_Handler *, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>;
+
+template class ACE_Hash_Map_Manager<ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator<ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator<ADDR, CACHED_HANDLER, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>;
// = Caching_Strategy
-template class ACE_Hash_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, CACHING_STRATEGY, ATTRIBUTES>;
-template class ACE_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP, HASH_MAP::iterator, HASH_MAP::reverse_iterator, CACHING_STRATEGY, ATTRIBUTES>;
-template class ACE_Cache_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP::iterator, CACHING_STRATEGY, ATTRIBUTES>;
-template class ACE_Cache_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP::reverse_iterator, CACHING_STRATEGY, ATTRIBUTES>;
+template class ACE_Hash_Cache_Map_Manager<ADDR, Svc_Handler *, H_KEY, C_KEYS, CACHING_STRATEGY, ATTRIBUTES>;
+
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+template class ACE_Cache_Map_Manager<ADDR, Svc_Handler *, HASH_MAP, HASH_MAP_ITERATOR, HASH_MAP_REVERSE_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>;
+template class ACE_Cache_Map_Iterator<ADDR, Svc_Handler *, HASH_MAP_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>;
+template class ACE_Cache_Map_Reverse_Iterator<ADDR, Svc_Handler *, HASH_MAP_REVERSE_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>;
+#else
+template class ACE_Cache_Map_Manager<ADDR, Svc_Handler *, HASH_MAP, CACHING_STRATEGY, ATTRIBUTES>;
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
template class ACE_Cached_Connect_Strategy_Ex<Svc_Handler, ACE_SOCK_CONNECTOR, CACHING_STRATEGY, ATTRIBUTES, ACE_SYNCH_NULL_MUTEX>;
template class ACE_Cached_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_NULL_MUTEX>;
-template class ACE_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>;
-template class ACE_Default_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>;
-template class ACE_Recyclable_Handler_Caching_Utility<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP::iterator, ATTRIBUTES>;
-template class ACE_Pair_Caching_Utility<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP::iterator, ATTRIBUTES>;
-template class ACE_Svc_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>;
+template class ACE_Cleanup_Strategy<ADDR, CACHED_HANDLER, HASH_MAP>;
+template class ACE_Recyclable_Handler_Cleanup_Strategy<ADDR, CACHED_HANDLER, HASH_MAP>;
+template class ACE_Recyclable_Handler_Caching_Utility<ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP_ITERATOR, ATTRIBUTES>;
-template class ACE_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>;
-template class ACE_LRU_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>;
-template class ACE_LFU_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>;
-template class ACE_FIFO_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>;
-template class ACE_Null_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>;
+template class ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>;
+template class ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>;
+template class ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>;
+template class ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>;
+template class ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>;
-template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY >;
-template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY >;
-template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY >;
-template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY >;
+template class ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY>;
+template class ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY>;
+template class ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY>;
+template class ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -523,16 +512,16 @@ template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CAC
#pragma instantiate ACE_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR>
#pragma instantiate ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>
#pragma instantiate ACE_Creation_Strategy<Svc_Handler>
-#pragma instantiate ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *>
-#pragma instantiate ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>
-#pragma instantiate ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>
-#pragma instantiate ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Entry<ADDR, Svc_Handler *>
+#pragma instantiate ACE_Hash<ADDR>
+#pragma instantiate ACE_Equal_To<ADDR>
+#pragma instantiate ACE_Hash_Map_Manager<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_SYNCH_RW_MUTEX>
#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>
#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>
#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>
@@ -541,54 +530,58 @@ template class ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CAC
#pragma instantiate ACE_NOOP_Concurrency_Strategy<Svc_Handler>
#pragma instantiate ACE_Recycling_Strategy<Svc_Handler>
#pragma instantiate ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>
-
#pragma instantiate ACE_Svc_Tuple<Svc_Handler>
#pragma instantiate ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR>
#pragma instantiate ACE_Pair<Svc_Handler *, ATTRIBUTES>
-#pragma instantiate ACE_Reference_Pair<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *>
-#pragma instantiate ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER>
-
-#pragma instantiate ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
-
-#pragma instantiate ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Reference_Pair<ADDR, Svc_Handler *>
+#pragma instantiate ACE_Hash_Map_Entry<ADDR, CACHED_HANDLER>
+
+#pragma instantiate ACE_Hash_Map_Manager<ADDR, Svc_Handler *, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator<ADDR, Svc_Handler *, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<ADDR, Svc_Handler *, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ADDR, Svc_Handler *, H_KEY, C_KEYS, ACE_Null_Mutex>
+
+#pragma instantiate ACE_Hash_Map_Manager<ADDR, CACHED_HANDLER, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator<ADDR, CACHED_HANDLER, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<ADDR, CACHED_HANDLER, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ADDR, CACHED_HANDLER, H_KEY, C_KEYS, ACE_Null_Mutex>
// = Caching_Strategy
-#pragma instantiate ACE_Hash_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, H_KEY, C_KEYS, CACHING_STRATEGY, ATTRIBUTES>
-#pragma instantiate ACE_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP, HASH_MAP::iterator, HASH_MAP::reverse_iterator, CACHING_STRATEGY, ATTRIBUTES>
-#pragma instantiate ACE_Cache_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP::iterator, CACHING_STRATEGY, ATTRIBUTES>
-#pragma instantiate ACE_Cache_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, HASH_MAP::reverse_iterator, CACHING_STRATEGY, ATTRIBUTES>
+#pragma instantiate ACE_Hash_Cache_Map_Manager<ADDR, Svc_Handler *, H_KEY, C_KEYS, CACHING_STRATEGY, ATTRIBUTES>
+
+#if !defined (ACE_HAS_BROKEN_EXTENDED_TEMPLATES)
+#pragma instantiate ACE_Cache_Map_Manager<ADDR, Svc_Handler *, HASH_MAP, HASH_MAP_ITERATOR, HASH_MAP_REVERSE_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>
+#pragma instantiate ACE_Cache_Map_Iterator<ADDR, Svc_Handler *, HASH_MAP_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>
+#pragma instantiate ACE_Cache_Map_Reverse_Iterator<ADDR, Svc_Handler *, HASH_MAP_REVERSE_ITERATOR, CACHING_STRATEGY, ATTRIBUTES>
+#else
+#pragma instantiate ACE_Cache_Map_Manager<ADDR, Svc_Handler *, HASH_MAP, CACHING_STRATEGY, ATTRIBUTES>
+#endif /* ACE_HAS_BROKEN_EXTENDED_TEMPLATES */
+
#pragma instantiate ACE_Cached_Connect_Strategy_Ex<Svc_Handler, ACE_SOCK_CONNECTOR, CACHING_STRATEGY, ATTRIBUTES, ACE_SYNCH_NULL_MUTEX>
#pragma instantiate ACE_Cached_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_NULL_MUTEX>
-#pragma instantiate ACE_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>
-#pragma instantiate ACE_Default_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>
-#pragma instantiate ACE_Recyclable_Handler_Caching_Utility<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP::iterator, ATTRIBUTES>
-#pragma instantiate ACE_Pair_Caching_Utility<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP::iterator, ATTRIBUTES>
-#pragma instantiate ACE_Svc_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP>
-
-#pragma instantiate ACE_Caching_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
-#pragma instantiate ACE_LRU_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
-#pragma instantiate ACE_LFU_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
-#pragma instantiate ACE_FIFO_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
-#pragma instantiate ACE_Null_Caching_Strategy <REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY>
-
-#pragma instantiate ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY >
-#pragma instantiate ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY >
-#pragma instantiate ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY >
-#pragma instantiate ACE_Caching_Strategy_Adapter<REFCOUNTED_HASH_RECYCLABLE_ADDR, CACHED_HANDLER, HASH_MAP, ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY >
+#pragma instantiate ACE_Cleanup_Strategy<ADDR, CACHED_HANDLER, HASH_MAP>
+#pragma instantiate ACE_Recyclable_Handler_Cleanup_Strategy<ADDR, CACHED_HANDLER, HASH_MAP>
+#pragma instantiate ACE_Recyclable_Handler_Caching_Utility<ADDR, CACHED_HANDLER, HASH_MAP, HASH_MAP_ITERATOR, ATTRIBUTES>
+
+#pragma instantiate ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
+#pragma instantiate ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
+#pragma instantiate ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
+#pragma instantiate ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
+#pragma instantiate ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>
+
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LRU_CACHING_STRATEGY>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, LFU_CACHING_STRATEGY>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, FIFO_CACHING_STRATEGY>
+#pragma instantiate ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, NULL_CACHING_STRATEGY>
+
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/tests/Cached_Conn_Test.dsp b/tests/Cached_Conn_Test.dsp
new file mode 100644
index 00000000000..1f6f2235fa5
--- /dev/null
+++ b/tests/Cached_Conn_Test.dsp
@@ -0,0 +1,194 @@
+# Microsoft Developer Studio Project File - Name="Cached_Conn_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+# TARGTYPE "Win32 (ALPHA) Console Application" 0x0603
+
+CFG=Cached_Conn_Test - Win32 PharLap ETS Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Cached_Conn_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Cached_Conn_Test.mak" CFG="Cached_Conn_Test - Win32 PharLap ETS Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Cached_Conn_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Cached_Conn_Test - Win32 Alpha Debug" (based on "Win32 (ALPHA) Console Application")
+!MESSAGE "Cached_Conn_Test - Win32 PharLap ETS Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "Cached_Conn_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Atomic_O"
+# PROP BASE Intermediate_Dir "Atomic_O"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir ".\DLL\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Cached_Conn_Test - Win32 Alpha Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Atomic_O"
+# PROP BASE Intermediate_Dir "Atomic_O"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\\ /D " WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /MTd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\\ /D " WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /MDd /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:ALPHA /pdbtype:sept /libpath:"..\ace"
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:ALPHA /pdbtype:sept /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Cached_Conn_Test - Win32 PharLap ETS Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Atomic_O"
+# PROP BASE Intermediate_Dir "Atomic_O"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir ".\ETS_LIB\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+CPP=cl.exe
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT BASE CPP /YX
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /out:"Cached_Conn_Test_ETS.exe" /pdbtype:sept /libpath:"..\ace" /ETS:tests_pharlap_msvc.lnk
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "Cached_Conn_Test - Win32 Debug"
+# Name "Cached_Conn_Test - Win32 Alpha Debug"
+# Name "Cached_Conn_Test - Win32 PharLap ETS Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Cached_Conn_Test.cpp
+
+!IF "$(CFG)" == "Cached_Conn_Test - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "Cached_Conn_Test - Win32 Alpha Debug"
+
+DEP_CPP_CACHE=\
+ "..\ace\ACE.h"\
+ "..\ace\ACE.i"\
+ "..\ace\Atomic_Op.i"\
+ "..\ace\Auto_Ptr.cpp"\
+ "..\ace\Auto_Ptr.h"\
+ "..\ace\Auto_Ptr.i"\
+ "..\ace\config-win32-common.h"\
+ "..\ace\config-win32.h"\
+ "..\ace\config.h"\
+ "..\ace\Event_Handler.h"\
+ "..\ace\Event_Handler.i"\
+ "..\ace\Log_Msg.h"\
+ "..\ace\Log_Priority.h"\
+ "..\ace\Log_Record.h"\
+ "..\ace\Log_Record.i"\
+ "..\ace\Managed_Object.cpp"\
+ "..\ace\Managed_Object.h"\
+ "..\ace\Managed_Object.i"\
+ "..\ace\Object_Manager.h"\
+ "..\ace\Object_Manager.i"\
+ "..\ace\OS.h"\
+ "..\ace\OS.i"\
+ "..\ace\SString.h"\
+ "..\ace\SString.i"\
+ "..\ace\SV_Semaphore_Complex.h"\
+ "..\ace\SV_Semaphore_Complex.i"\
+ "..\ace\SV_Semaphore_Simple.h"\
+ "..\ace\SV_Semaphore_Simple.i"\
+ "..\ace\Synch.h"\
+ "..\ace\Synch.i"\
+ "..\ace\Synch_T.cpp"\
+ "..\ace\Synch_T.h"\
+ "..\ace\Synch_T.i"\
+ "..\ace\Thread.h"\
+ "..\ace\Thread.i"\
+ "..\ace\Trace.h"\
+ "..\ace\Version.h"\
+ "..\ace\ws2tcpip.h"\
+ ".\test_config.h"\
+
+NODEP_CPP_CACHE=\
+ "..\ace\stdcpp.h"\
+
+
+!ELSEIF "$(CFG)" == "Cached_Conn_Test - Win32 PharLap ETS Debug"
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp
index dbf3e29317c..1b110aebae4 100644
--- a/tests/Conn_Test.cpp
+++ b/tests/Conn_Test.cpp
@@ -718,14 +718,16 @@ main (int argc, ASYS_TCHAR *argv[])
// Bind acceptor to any port and then find out what the port was.
if (acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &)) == -1
|| acceptor.acceptor ().get_local_addr (server_addr) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("open")));
+ {
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("(%P|%t) %p\n"),
+ ASYS_TEXT ("open")));
+ ACE_ASSERT (0);
+ }
else
{
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("(%P|%t) starting server at port %d\n"),
-
server_addr.get_port_number ()));
#if !defined (ACE_LACKS_FORK)
diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp
index 0b6fb1dae66..05a35c121eb 100644
--- a/tests/Map_Manager_Test.cpp
+++ b/tests/Map_Manager_Test.cpp
@@ -71,9 +71,11 @@ typedef ACE_Hash_Map_Iterator_Ex<TYPE, ACE_Pair<TYPE, int>, HASH_KEY, COMPARE_KE
typedef ACE_Hash_Map_Reverse_Iterator_Ex<TYPE, ACE_Pair<TYPE, int>, HASH_KEY, COMPARE_KEYS, MUTEX>
CACHE_REV_ITER_IMPL;
typedef int ATTR;
+typedef ACE_Null_Cleanup_Strategy<TYPE, TYPE, CACHE_MAP_IMPL>
+ NULL_CLEANUP;
typedef ACE_Null_Caching_Utility <TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, ATTR>
NULL_UTILITY;
-typedef ACE_Null_Caching_Strategy<TYPE, TYPE, CACHE_MAP_IMPL, ATTR, NULL_UTILITY>
+typedef ACE_Null_Caching_Strategy<ATTR, NULL_UTILITY>
NULL_CACHING_STRATEGY;
typedef ACE_Cache_Map_Manager<TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
CACHE_MAP_MANAGER;
@@ -950,16 +952,18 @@ template class ACE_Map_Iterator_Base<ACE_Active_Map_Manager_Key, TYPE, MUTEX>;
template class ACE_Map_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>;
template class ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>;
template class ACE_Map_Entry<ACE_Active_Map_Manager_Key, TYPE>;
-template class ACE_Hash_Map_Manager_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
-template class ACE_Hash_Map_Iterator_Base_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
-template class ACE_Hash_Map_Iterator_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
+template class ACE_Hash_Map_Manager_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
+template class ACE_Hash_Map_Iterator_Base_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
+template class ACE_Hash_Map_Iterator_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>;
template class ACE_Hash_Map_Entry<TYPE, ACE_Pair<TYPE, ATTR> >;
-template class ACE_Null_Caching_Utility <TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, ATTR>;
-template class ACE_Null_Caching_Strategy <TYPE, TYPE, CACHE_MAP_IMPL, ATTR, NULL_UTILITY>;
-template class ACE_Hash_Cache_Map_Manager <TYPE, TYPE, HASH_KEY, COMPARE_KEYS, NULL_CACHING_STRATEGY, ATTR> ;
-template class ACE_Cache_Map_Manager <TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR> ;
-template class ACE_Cache_Map_Iterator <TYPE, TYPE, CACHE_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR> ;
+template class ACE_Cleanup_Strategy<TYPE, TYPE, CACHE_MAP_IMPL>;
+template class ACE_Null_Cleanup_Strategy<TYPE, TYPE, CACHE_MAP_IMPL>;
+template class ACE_Null_Caching_Utility<TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, ATTR>;
+template class ACE_Null_Caching_Strategy<ATTR, NULL_UTILITY>;
+template class ACE_Hash_Cache_Map_Manager<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, NULL_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Manager<TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>;
+template class ACE_Cache_Map_Iterator<TYPE, TYPE, CACHE_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>;
template class ACE_Cache_Map_Reverse_Iterator<TYPE,TYPE, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Equal_To<TYPE>
@@ -981,15 +985,17 @@ template class ACE_Cache_Map_Reverse_Iterator<TYPE,TYPE, CACHE_REV_ITER_IMPL, NU
#pragma instantiate ACE_Map_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>
#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>
#pragma instantiate ACE_Map_Entry<ACE_Active_Map_Manager_Key, TYPE>
-#pragma instantiate ACE_Hash_Map_Manager_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex <TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TYPE, ACE_Pair<TYPE, ATTR>, HASH_KEY, COMPARE_KEYS, MUTEX>
#pragma instantiate ACE_Hash_Map_Entry<TYPE, ACE_Pair<TYPE, ATTR> >
-#pragma instantiate ACE_Null_Caching_Utility <TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, ATTR>
-#pragma instantiate ACE_Null_Caching_Strategy <TYPE, TYPE, CACHE_MAP_IMPL, ATTR, NULL_UTILITY>
-#pragma instantiate ACE_Hash_Cache_Map_Manager <TYPE, TYPE, HASH_KEY, COMPARE_KEYS, NULL_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Manager <TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
-#pragma instantiate ACE_Cache_Map_Iterator <TYPE, TYPE, CACHE_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Null_Cleanup_Strategy<TYPE, TYPE, CACHE_MAP_IMPL>
+#pragma instantiate ACE_Cleanup_Strategy<TYPE, TYPE, CACHE_MAP_IMPL>
+#pragma instantiate ACE_Null_Caching_Utility<TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, ATTR>
+#pragma instantiate ACE_Null_Caching_Strategy<ATTR, NULL_UTILITY>
+#pragma instantiate ACE_Hash_Cache_Map_Manager<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, NULL_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Manager<TYPE, TYPE, CACHE_MAP_IMPL, CACHE_ITER_IMPL, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
+#pragma instantiate ACE_Cache_Map_Iterator<TYPE, TYPE, CACHE_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
#pragma instantiate ACE_Cache_Map_Reverse_Iterator<TYPE,TYPE, CACHE_REV_ITER_IMPL, NULL_CACHING_STRATEGY, ATTR>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/tests/tests.dsw b/tests/tests.dsw
index 4bf8393e600..8d3777c3250 100644
--- a/tests/tests.dsw
+++ b/tests/tests.dsw
@@ -87,6 +87,18 @@ Package=<4>
###############################################################################
+Project: "Cached_Conn_Test"=.\Cached_Conn_Test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Collection_Test"=.\Collection_Test.dsp - Package Owner=<4>
Package=<5>