summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-99b30
-rw-r--r--ace/Cached_Connect_Strategy_T.cpp44
-rw-r--r--ace/Cached_Connect_Strategy_T.h7
-rw-r--r--ace/Caching_Utility_T.cpp4
-rw-r--r--ace/OS.h115
-rw-r--r--ace/Strategies.h13
-rw-r--r--ace/Strategies.i10
-rw-r--r--ace/Strategies_T.cpp207
-rw-r--r--ace/Strategies_T.h38
-rw-r--r--ace/Strategies_T.i2
-rw-r--r--ace/Svc_Handler.cpp15
-rw-r--r--ace/Svc_Handler.h8
-rw-r--r--tests/Cached_Accept_Conn_Test.cpp5
-rw-r--r--tests/Cached_Conn_Test.cpp2
14 files changed, 333 insertions, 167 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index d291ef1768b..0e3f95167d7 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,33 @@
+Mon Jul 19 19:46:50 1999 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * ace/OS.h: Added ACE_*_cast_*_ptr and ACE_*_cast_*_ref for const,
+ static, and reinterpret casts.
+
+ * ace/Strategies_T.cpp (find):
+ * ace/Cached_Connect_Strategy_T.cpp (find):
+
+ The comparison should be between ACE_PEER_CONNECTOR_ADDR and not
+ REFCOUNTED_HASH_RECYCLABLE_ADDRESS.
+
+ * ace/Svc_Handler: Changed <state> to <recycle_state>. <state>
+ was too generic and in some cases a <state> method was already
+ present in classes deriving from Svc_Handler.
+
+ Also, added a <recycle_state> accessor.
+
+ The following files were effected:
+
+ - ace/Cached_Connect_Strategy_T.cpp
+ - ace/Cached_Connect_Strategy_T.h
+ - ace/Caching_Utility_T.cpp
+ - ace/Strategies.h
+ - ace/Strategies.i
+ - ace/Strategies_T.cpp
+ - ace/Strategies_T.h
+ - ace/Strategies_T.i
+ - tests/Cached_Accept_Conn_Test.cpp
+ - tests/Cached_Conn_Test.cpp
+
Mon Jul 19 20:08:15 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
* ace/Strategies_T.cpp:
diff --git a/ace/Cached_Connect_Strategy_T.cpp b/ace/Cached_Connect_Strategy_T.cpp
index ffc0aa83543..71b570e2723 100644
--- a/ace/Cached_Connect_Strategy_T.cpp
+++ b/ace/Cached_Connect_Strategy_T.cpp
@@ -88,7 +88,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i
CONNECTION_CACHE_ENTRY *possible_entry = (CONNECTION_CACHE_ENTRY *) sh->recycling_act ();
// Check to see if the hint svc_handler has been closed down
- if (possible_entry->ext_id_.state () == ACE_RECYCLABLE_CLOSED)
+ if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED)
{
// If close, decrement refcount
if (possible_entry->ext_id_.decrement () == 0)
@@ -108,8 +108,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i
// If hint is not closed, see if it is connected to the correct
// address and is recyclable
- else if ((possible_entry->ext_id_.state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
- possible_entry->ext_id_.state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) &&
+ else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
+ possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) &&
possible_entry->ext_id_.subject () == remote_addr)
{
// Hint successful
@@ -315,7 +315,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::connect_svc_handler_i
// For all successful cases: mark the <svc_handler> in the cache
// as being <in_use>. Therefore recyclable is BUSY.
- entry->ext_id_.state (ACE_RECYCLABLE_BUSY);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY);
// And increment the refcount
entry->ext_id_.increment ();
@@ -332,11 +332,35 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cache_i (const void *recycling_act)
// Mark the <svc_handler> in the cache as not being <in_use>.
// Therefore recyclable is IDLE.
- entry->ext_id_.state (ACE_RECYCLABLE_IDLE_AND_PURGABLE);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE);
return 0;
}
+template<ACE_T1> int
+ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act,
+ ACE_Recyclable_State new_state)
+{
+ // The wonders and perils of ACT
+ CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
+
+ // Mark the <svc_handler> in the cache as not being <in_use>.
+ // Therefore recyclable is IDLE.
+ entry->ext_id_.recycle_state (new_state);
+
+ return 0;
+}
+
+template<ACE_T1> ACE_Recyclable_State
+ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act) const
+{
+ // The wonders and perils of ACT
+ CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
+
+ // Mark the <svc_handler> in the cache as not being <in_use>.
+ // Therefore recyclable is IDLE.
+ return entry->ext_id_.recycle_state ();
+}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_i (const void *recycling_act)
@@ -355,7 +379,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::mark_as_closed_i (const void *recycling_
CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
// Mark the <svc_handler> in the cache as CLOSED.
- entry->ext_id_.state (ACE_RECYCLABLE_CLOSED);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED);
return 0;
}
@@ -371,7 +395,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup_hint_i (const void *recycling_ac
// If the svc_handler state is closed and the refcount == 0, call
// close() on svc_handler.
- if (entry->ext_id_.state () == ACE_RECYCLABLE_CLOSED &&
+ if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED &&
refcount == 0)
{
entry->int_id_.first ()->recycler (0, 0);
@@ -418,11 +442,11 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE
{
REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_;
- if (addr.state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE &&
- addr.state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE)
+ if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE &&
+ addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE)
continue;
- if (addr != search_addr)
+ if (addr.subject () != search_addr.subject ())
continue;
entry = &(*iterator);
diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h
index a9e379b2ad8..fc8beb1933d 100644
--- a/ace/Cached_Connect_Strategy_T.h
+++ b/ace/Cached_Connect_Strategy_T.h
@@ -105,6 +105,11 @@ protected:
virtual int cache_i (const void *recycling_act);
// Add to cache (non-locking version).
+ virtual int recycle_state_i (const void *recycling_act,
+ ACE_Recyclable_State new_state);
+ virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const;
+ // Get/Set <recycle_state> (non-locking version).
+
virtual int mark_as_closed_i (const void *recycling_act);
// Mark as closed (non-locking version).
@@ -112,7 +117,6 @@ protected:
// Cleanup hint.
// = Helpers
-
virtual int check_hint_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -123,7 +127,6 @@ protected:
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found);
-
virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp
index 8ae6be83539..2d9b4c072ef 100644
--- a/ace/Caching_Utility_T.cpp
+++ b/ace/Caching_Utility_T.cpp
@@ -205,8 +205,8 @@ 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.
- if ((*iter).ext_id_.state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
- (*iter).ext_id_.state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE)
+ if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
+ (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE)
{
if (found == 0)
{
diff --git a/ace/OS.h b/ace/OS.h
index f8e5e7c279e..08c373d6361 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -84,40 +84,111 @@ enum ACE_Recyclable_State
# endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */
# if defined (ACE_HAS_ANSI_CASTS)
+
# define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any))
+
# define ACE_static_cast(TYPE, EXPR) static_cast<TYPE> (EXPR)
+# define ACE_static_cast_1_ptr(TYPE, T1, EXPR) static_cast<TYPE<T1> *> (EXPR)
+# define ACE_static_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> *> (EXPR)
+# define ACE_static_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> *> (EXPR)
+# define ACE_static_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> *> (EXPR)
+# define ACE_static_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR)
+# define ACE_static_cast_1_ref(TYPE, T1, EXPR) static_cast<TYPE<T1> &> (EXPR)
+# define ACE_static_cast_2_ref(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> &> (EXPR)
+# define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> &> (EXPR)
+# define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
+# define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# define ACE_const_cast(TYPE, EXPR) const_cast<TYPE> (EXPR)
+# define ACE_const_cast_1_ptr(TYPE, T1, EXPR) const_cast<TYPE<T1> *> (EXPR)
+# define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) const_cast<TYPE<T1, T2> *> (EXPR)
+# define ACE_const_cast_3_ptr(TYPE, T1, T2, T3, EXPR) const_cast<TYPE<T1, T2, T3> *> (EXPR)
+# define ACE_const_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) const_cast<TYPE<T1, T2, T3, T4> *> (EXPR)
+# define ACE_const_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR)
+# define ACE_const_cast_1_ref(TYPE, T1, EXPR) const_cast<TYPE<T1> &> (EXPR)
+# define ACE_const_cast_2_ref(TYPE, T1, T2, EXPR) const_cast<TYPE<T1, T2> &> (EXPR)
+# define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) const_cast<TYPE<T1, T2, T3> &> (EXPR)
+# define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) const_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
+# define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast<TYPE> (EXPR)
+# define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) reinterpret_cast<TYPE<T1> *> (EXPR)
+# define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) reinterpret_cast<TYPE<T1, T2> *> (EXPR)
+# define ACE_reinterpret_cast_3_ptr(TYPE, T1, T2, T3, EXPR) reinterpret_cast<TYPE<T1, T2, T3> *> (EXPR)
+# define ACE_reinterpret_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4> *> (EXPR)
+# define ACE_reinterpret_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR)
+# define ACE_reinterpret_cast_1_ref(TYPE, T1, EXPR) reinterpret_cast<TYPE<T1> &> (EXPR)
+# define ACE_reinterpret_cast_2_ref(TYPE, T1, T2, EXPR) reinterpret_cast<TYPE<T1, T2> &> (EXPR)
+# define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) reinterpret_cast<TYPE<T1, T2, T3> &> (EXPR)
+# define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
+# define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+
# if defined (ACE_LACKS_RTTI)
-# define ACE_dynamic_cast(TYPE, EXPR) static_cast< TYPE > (EXPR)
-# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) static_cast< TYPE<T1> *> (EXPR)
-# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast< TYPE<T1, T2> *> (EXPR)
-# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast< TYPE<T1, T2, T3> *> (EXPR)
-# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast< TYPE<T1, T2, T3, T4> *> (EXPR)
-# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast< TYPE<T1, T2, T3, T4, T5> *> (EXPR)
-# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) static_cast< TYPE<T1> &> (EXPR)
-# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) static_cast< TYPE<T1, T2> &> (EXPR)
-# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast< TYPE<T1, T2, T3> &> (EXPR)
-# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast< TYPE<T1, T2, T3, T4> &> (EXPR)
-# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast< TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+# define ACE_dynamic_cast(TYPE, EXPR) static_cast<TYPE> (EXPR)
+# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) static_cast<TYPE<T1> *> (EXPR)
+# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> *> (EXPR)
+# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> *> (EXPR)
+# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> *> (EXPR)
+# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR)
+# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) static_cast<TYPE<T1> &> (EXPR)
+# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> &> (EXPR)
+# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> &> (EXPR)
+# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
+# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
# else /* ! ACE_LACKS_RTTI */
-# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast< TYPE > (EXPR)
-# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast< TYPE<T1> *> (EXPR)
-# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast< TYPE<T1, T2> *> (EXPR)
-# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast< TYPE<T1, T2, T3> *> (EXPR)
-# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4> *> (EXPR)
-# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4, T5> *> (EXPR)
-# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast< TYPE<T1> &> (EXPR)
-# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast< TYPE<T1, T2> &> (EXPR)
-# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast< TYPE<T1, T2, T3> &> (EXPR)
-# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4> &> (EXPR)
-# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4, T5> &> (EXPR)
+# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast<TYPE> (EXPR)
+# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast<TYPE<T1> *> (EXPR)
+# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast<TYPE<T1, T2> *> (EXPR)
+# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast<TYPE<T1, T2, T3> *> (EXPR)
+# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4> *> (EXPR)
+# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR)
+# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast<TYPE<T1> &> (EXPR)
+# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast<TYPE<T1, T2> &> (EXPR)
+# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast<TYPE<T1, T2, T3> &> (EXPR)
+# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4> &> (EXPR)
+# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR)
# endif /* ! ACE_LACKS_RTTI */
+
# else
+
# define ACE_sap_any_cast(TYPE) ((TYPE) (ACE_Addr::sap_any))
+
# define ACE_static_cast(TYPE, EXPR) ((TYPE) (EXPR))
+# define ACE_static_cast_1_ptr(TYPE, T1, EXPR) ((TYPE<T1> *) (EXPR))
+# define ACE_static_cast_2_ptr(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> *) (EXPR))
+# define ACE_static_cast_3_ptr(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> *) (EXPR))
+# define ACE_static_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> *) (EXPR))
+# define ACE_static_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> *) (EXPR))
+# define ACE_static_cast_1_ref(TYPE, T1, EXPR) ((TYPE<T1> &) (EXPR))
+# define ACE_static_cast_2_ref(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> &) (EXPR))
+# define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> &) (EXPR))
+# define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> &) (EXPR))
+# define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> &) (EXPR))
+
# define ACE_const_cast(TYPE, EXPR) ((TYPE) (EXPR))
+# define ACE_const_cast_1_ptr(TYPE, T1, EXPR) ((TYPE<T1> *) (EXPR))
+# define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> *) (EXPR))
+# define ACE_const_cast_3_ptr(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> *) (EXPR))
+# define ACE_const_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> *) (EXPR))
+# define ACE_const_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> *) (EXPR))
+# define ACE_const_cast_1_ref(TYPE, T1, EXPR) ((TYPE<T1> &) (EXPR))
+# define ACE_const_cast_2_ref(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> &) (EXPR))
+# define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> &) (EXPR))
+# define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> &) (EXPR))
+# define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> &) (EXPR))
+
# define ACE_reinterpret_cast(TYPE, EXPR) ((TYPE) (EXPR))
+# define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) ((TYPE<T1> *) (EXPR))
+# define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> *) (EXPR))
+# define ACE_reinterpret_cast_3_ptr(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> *) (EXPR))
+# define ACE_reinterpret_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> *) (EXPR))
+# define ACE_reinterpret_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> *) (EXPR))
+# define ACE_reinterpret_cast_1_ref(TYPE, T1, EXPR) ((TYPE<T1> &) (EXPR))
+# define ACE_reinterpret_cast_2_ref(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> &) (EXPR))
+# define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> &) (EXPR))
+# define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> &) (EXPR))
+# define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> &) (EXPR))
+
# define ACE_dynamic_cast(TYPE, EXPR) ((TYPE) (EXPR))
# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) ((TYPE<T1> *) (EXPR))
# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> *) (EXPR))
diff --git a/ace/Strategies.h b/ace/Strategies.h
index c43ec639aa2..1574557cf37 100644
--- a/ace/Strategies.h
+++ b/ace/Strategies.h
@@ -100,9 +100,10 @@ public:
virtual int cache (const void *recycling_act) = 0;
// Add to cache.
- virtual int state (const void *recycling_act,
- ACE_Recyclable_State new_state) = 0;
- // Change state to <new_state>.
+ virtual int recycle_state (const void *recycling_act,
+ ACE_Recyclable_State new_state) = 0;
+ virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0;
+ // Get/Set <recycle_state>.
virtual int mark_as_closed (const void *recycling_act) = 0;
// Mark as closed.
@@ -122,14 +123,14 @@ public:
// Destructor.
// = Set/Get the recyclable bit
- ACE_Recyclable_State state (void) const;
- void state (ACE_Recyclable_State new_state);
+ ACE_Recyclable_State recycle_state (void) const;
+ void recycle_state (ACE_Recyclable_State new_state);
protected:
ACE_Recyclable (ACE_Recyclable_State initial_state);
// Protected constructor.
- ACE_Recyclable_State state_;
+ ACE_Recyclable_State recycle_state_;
// Our state.
};
diff --git a/ace/Strategies.i b/ace/Strategies.i
index c3fd4d39651..d970ef75f65 100644
--- a/ace/Strategies.i
+++ b/ace/Strategies.i
@@ -15,7 +15,7 @@ ACE_Connection_Recycling_Strategy::ACE_Connection_Recycling_Strategy (void)
ACE_INLINE
ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state)
- : state_ (initial_state)
+ : recycle_state_ (initial_state)
{
}
@@ -25,15 +25,15 @@ ACE_Recyclable::~ACE_Recyclable (void)
}
ACE_INLINE ACE_Recyclable_State
-ACE_Recyclable::state (void) const
+ACE_Recyclable::recycle_state (void) const
{
- return this->state_;
+ return this->recycle_state_;
}
ACE_INLINE void
-ACE_Recyclable::state (ACE_Recyclable_State new_state)
+ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state)
{
- this->state_ = new_state;
+ this->recycle_state_ = new_state;
}
ACE_INLINE
diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp
index 20db86e1f05..f2d720bff58 100644
--- a/ace/Strategies_T.cpp
+++ b/ace/Strategies_T.cpp
@@ -228,9 +228,9 @@ ACE_Thread_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handler
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy
- (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
- int restart,
- ACE_Reactor *reactor)
+(const ACE_PEER_ACCEPTOR_ADDR &local_addr,
+ int restart,
+ ACE_Reactor *reactor)
: reactor_ (reactor)
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy");
@@ -243,7 +243,7 @@ ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler
- (SVC_HANDLER *svc_handler)
+(SVC_HANDLER *svc_handler)
{
ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler");
@@ -271,13 +271,13 @@ ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler
- (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)
+(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)
{
ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler");
@@ -292,14 +292,14 @@ ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler
- (SVC_HANDLER *&sh,
- SVC_HANDLER *&sh_copy,
- 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)
+(SVC_HANDLER *&sh,
+ SVC_HANDLER *&sh_copy,
+ 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)
{
ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler");
@@ -368,19 +368,19 @@ ACE_Process_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *svc_handle
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX>
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::ACE_Cached_Connect_Strategy
- (ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
- ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
- ACE_Recycling_Strategy<SVC_HANDLER> *rec_s,
- MUTEX *lock,
- int delete_lock)
- : lock_ (lock),
- delete_lock_ (delete_lock),
- creation_strategy_ (0),
- delete_creation_strategy_ (0),
- concurrency_strategy_ (0),
- delete_concurrency_strategy_ (0),
- recycling_strategy_ (0),
- delete_recycling_strategy_ (0)
+(ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
+ ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
+ ACE_Recycling_Strategy<SVC_HANDLER> *rec_s,
+ MUTEX *lock,
+ int delete_lock)
+ : lock_ (lock),
+ delete_lock_ (delete_lock),
+ creation_strategy_ (0),
+ delete_creation_strategy_ (0),
+ concurrency_strategy_ (0),
+ delete_concurrency_strategy_ (0),
+ recycling_strategy_ (0),
+ delete_recycling_strategy_ (0)
{
// Create a new lock if necessary.
if (this->lock_ == 0)
@@ -431,9 +431,9 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::~ACE_Cach
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::open
- (ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
- ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
- ACE_Recycling_Strategy<SVC_HANDLER> *rec_s)
+(ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
+ ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
+ ACE_Recycling_Strategy<SVC_HANDLER> *rec_s)
{
// Initialize the creation strategy.
@@ -501,15 +501,15 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::open
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::check_hint_i
- (SVC_HANDLER *&sh,
- const ACE_PEER_CONNECTOR_ADDR &remote_addr,
- ACE_Time_Value *timeout,
- const ACE_PEER_CONNECTOR_ADDR &local_addr,
- int reuse_addr,
- int flags,
- int perms,
- ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
- int &found)
+(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,
+ ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
+ int &found)
{
ACE_UNUSED_ARG (remote_addr);
ACE_UNUSED_ARG (timeout);
@@ -524,7 +524,7 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::check_hin
CONNECTION_MAP_ENTRY *possible_entry = (CONNECTION_MAP_ENTRY *) sh->recycling_act ();
// Check to see if the hint svc_handler has been closed down
- if (possible_entry->ext_id_.state () == ACE_RECYCLABLE_CLOSED)
+ if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED)
{
// If close, decrement refcount
if (possible_entry->ext_id_.decrement () == 0)
@@ -544,8 +544,8 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::check_hin
// If hint is not closed, see if it is connected to the correct
// address and is recyclable
- else if ((possible_entry->ext_id_.state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
- possible_entry->ext_id_.state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) &&
+ else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
+ possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) &&
possible_entry->ext_id_.subject () == remote_addr)
{
// Hint successful
@@ -576,15 +576,15 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::check_hin
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::find_or_create_svc_handler_i
- (SVC_HANDLER *&sh,
- const ACE_PEER_CONNECTOR_ADDR &remote_addr,
- ACE_Time_Value *timeout,
- const ACE_PEER_CONNECTOR_ADDR &local_addr,
- int reuse_addr,
- int flags,
- int perms,
- ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
- int &found)
+(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,
+ ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
+ int &found)
{
// Explicit type conversion
REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr);
@@ -650,13 +650,13 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::find_or_c
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_svc_handler
- (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)
+(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)
{
int found = 0;
@@ -700,14 +700,14 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_s
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_svc_handler
- (SVC_HANDLER *&sh,
- SVC_HANDLER *&sh_copy,
- 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)
+(SVC_HANDLER *&sh,
+ SVC_HANDLER *&sh_copy,
+ 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)
{
int found = 0;
@@ -753,14 +753,14 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_s
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_svc_handler_i
- (SVC_HANDLER *&sh,
- const ACE_PEER_CONNECTOR_ADDR &remote_addr,
- ACE_Time_Value *timeout,
- const ACE_PEER_CONNECTOR_ADDR &local_addr,
- int reuse_addr,
- int flags,
- int perms,
- int& found)
+(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,
+ int& found)
{
CONNECTION_MAP_ENTRY *entry = 0;
@@ -798,7 +798,7 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_s
// For all successful cases: mark the <svc_handler> in the cache
// as being <in_use>. Therefore recyclable is BUSY.
- entry->ext_id_.state (ACE_RECYCLABLE_BUSY);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY);
// And increment the refcount
entry->ext_id_.increment ();
@@ -825,38 +825,61 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::cache_i (
// Mark the <svc_handler> in the cache as not being <in_use>.
// Therefore recyclable is IDLE.
- entry->ext_id_.state (ACE_RECYCLABLE_IDLE_AND_PURGABLE);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE);
return 0;
}
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
-ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::state (const void *recycling_act,
- ACE_Recyclable_State new_state)
+ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::recycle_state (const void *recycling_act,
+ ACE_Recyclable_State new_state)
{
// Synchronization is required here as the setting of the recyclable
// state must be done atomically with respect to other threads that
// are querying the cache.
ACE_GUARD_RETURN (MUTEX, ace_mon, *this->lock_, -1);
- return this->state_i (recycling_act,
- new_state);
+ return this->recycle_state_i (recycling_act,
+ new_state);
}
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
-ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::state_i (const void *recycling_act,
- ACE_Recyclable_State new_state)
+ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::recycle_state_i (const void *recycling_act,
+ ACE_Recyclable_State new_state)
{
// The wonders and perils of ACT
CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act;
// Mark the <svc_handler> in the cache as not being <in_use>.
// Therefore recyclable is IDLE.
- entry->ext_id_.state (new_state);
+ entry->ext_id_.recycle_state (new_state);
return 0;
}
+template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ACE_Recyclable_State
+ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::recycle_state (const void *recycling_act) const
+{
+ // Const cast.
+ SELF *fake_this = ACE_const_cast (SELF *, this);
+
+ // Synchronization is required here.
+ ACE_GUARD_RETURN (MUTEX, ace_mon, *fake_this->lock_, ACE_RECYCLABLE_UNKNOWN);
+
+ return this->recycle_state_i (recycling_act);
+}
+
+template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> ACE_Recyclable_State
+ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::recycle_state_i (const void *recycling_act) const
+{
+ // The wonders and perils of ACT
+ CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act;
+
+ // Mark the <svc_handler> in the cache as not being <in_use>.
+ // Therefore recyclable is IDLE.
+ return entry->ext_id_.recycle_state ();
+}
+
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class MUTEX> int
ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::purge (const void *recycling_act)
{
@@ -893,7 +916,7 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::mark_as_c
CONNECTION_MAP_ENTRY *entry = (CONNECTION_MAP_ENTRY *) recycling_act;
// Mark the <svc_handler> in the cache as CLOSED.
- entry->ext_id_.state (ACE_RECYCLABLE_CLOSED);
+ entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED);
return 0;
}
@@ -919,7 +942,7 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::cleanup_h
// If the svc_handler state is closed and the refcount == 0, call
// close() on svc_handler.
- if (entry->ext_id_.state () == ACE_RECYCLABLE_CLOSED &&
+ if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED &&
refcount == 0)
{
entry->int_id_->recycler (0, 0);
@@ -972,8 +995,8 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::find (ACE
{
REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_;
- if (addr.state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE &&
- addr.state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE)
+ if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE &&
+ addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE)
continue;
if (addr.subject () != search_addr.subject ())
diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h
index c24439ba96b..fd57ce03bc4 100644
--- a/ace/Strategies_T.h
+++ b/ace/Strategies_T.h
@@ -682,6 +682,8 @@ class ACE_Cached_Connect_Strategy : public ACE_Connection_Recycling_Strategy, pu
// It's added value is re-use of established connections.
public:
+ typedef ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX> SELF;
+
ACE_Cached_Connect_Strategy (ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0,
ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0,
@@ -747,9 +749,10 @@ public:
virtual int cache (const void *recycling_act);
// Add to cache.
- virtual int state (const void *recycling_act,
- ACE_Recyclable_State new_state);
- // Change state to <new_state>.
+ virtual int recycle_state (const void *recycling_act,
+ ACE_Recyclable_State new_state);
+ virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const;
+ // Get/Set <recycle_state>.
virtual int mark_as_closed (const void *recycling_act);
// Mark as closed.
@@ -772,9 +775,9 @@ public:
// = Typedefs for managing the map
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>
REFCOUNTED_HASH_RECYCLABLE_ADDRESS;
- typedef ACE_Hash_Map_Manager <REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Null_Mutex>
+ typedef ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Null_Mutex>
CONNECTION_MAP;
- typedef ACE_Hash_Map_Iterator <REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Null_Mutex>
+ typedef ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *, ACE_Null_Mutex>
CONNECTION_MAP_ITERATOR;
typedef ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, SVC_HANDLER *>
CONNECTION_MAP_ENTRY;
@@ -796,9 +799,10 @@ protected:
virtual int cache_i (const void *recycling_act);
// Add to cache (non-locking version).
- virtual int state_i (const void *recycling_act,
- ACE_Recyclable_State new_state);
- // Change state to <new_state> (non-locking version).
+ virtual int recycle_state_i (const void *recycling_act,
+ ACE_Recyclable_State new_state);
+ virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const;
+ // Get/Set <recycle_state> (non-locking version).
virtual int mark_as_closed_i (const void *recycling_act);
// Mark as closed (non-locking version).
@@ -817,15 +821,6 @@ protected:
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
int &found);
- virtual int connect_svc_handler_i (SVC_HANDLER *&sh,
- const ACE_PEER_CONNECTOR_ADDR &remote_addr,
- ACE_Time_Value *timeout,
- const ACE_PEER_CONNECTOR_ADDR &local_addr,
- int reuse_addr,
- int flags,
- int perms,
- int &found);
-
int find_or_create_svc_handler_i (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -836,6 +831,15 @@ protected:
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, SVC_HANDLER *> *&entry,
int &found);
+ virtual int connect_svc_handler_i (SVC_HANDLER *&sh,
+ const ACE_PEER_CONNECTOR_ADDR &remote_addr,
+ ACE_Time_Value *timeout,
+ const ACE_PEER_CONNECTOR_ADDR &local_addr,
+ int reuse_addr,
+ int flags,
+ int perms,
+ int &found);
+
CONNECTION_MAP connection_cache_;
// Table that maintains the cache of connected <SVC_HANDLER>s.
diff --git a/ace/Strategies_T.i b/ace/Strategies_T.i
index 4faf111f091..80932a5ea73 100644
--- a/ace/Strategies_T.i
+++ b/ace/Strategies_T.i
@@ -369,7 +369,7 @@ ACE_Refcounted_Hash_Recyclable<T>::subject (void)
template <class T> ASYS_INLINE int
ACE_Refcounted_Hash_Recyclable<T>::operator== (const ACE_Refcounted_Hash_Recyclable<T> &rhs) const
{
- return this->state () == rhs.state () &&
+ return this->recycle_state () == rhs.recycle_state () &&
this->t_ == rhs.t_;
}
diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp
index 6307f5765a6..ce9a3f1861e 100644
--- a/ace/Svc_Handler.cpp
+++ b/ace/Svc_Handler.cpp
@@ -301,15 +301,24 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::idle (u_long flags)
}
template <PR_ST_1, ACE_SYNCH_DECL> int
-ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::state (ACE_Recyclable_State new_state)
+ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::recycle_state (ACE_Recyclable_State new_state)
{
if (this->recycler ())
- return this->recycler ()->state (this->recycling_act_,
- new_state);
+ return this->recycler ()->recycle_state (this->recycling_act_,
+ new_state);
return 0;
}
+template <PR_ST_1, ACE_SYNCH_DECL> ACE_Recyclable_State
+ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::recycle_state (void) const
+{
+ if (this->recycler ())
+ return this->recycler ()->recycle_state (this->recycling_act_);
+
+ return ACE_RECYCLABLE_UNKNOWN;
+}
+
template <PR_ST_1, ACE_SYNCH_DECL> void
ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::recycler (ACE_Connection_Recycling_Strategy *recycler,
const void *recycling_act)
diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h
index 36a341c45cc..c15a97c5009 100644
--- a/ace/Svc_Handler.h
+++ b/ace/Svc_Handler.h
@@ -71,10 +71,12 @@ public:
// instead of closing it. If the object does not have a recycler,
// it will be closed.
- virtual int state (ACE_Recyclable_State new_state);
- // Call this method if you want to change the state of the
+ virtual ACE_Recyclable_State recycle_state (void) const;
+ virtual int recycle_state (ACE_Recyclable_State new_state);
+ // Call this method if you want to get/set the state of the
// <Svc_Handler>. If the object does not have a recycler, this call
- // will have no effect.
+ // will have no effect (and the accessor will return
+ // ACE_RECYCLABLE_UNKNOWN).
virtual void cleanup_hint (void);
// When the svc_handle is no longer needed around as a hint, call
diff --git a/tests/Cached_Accept_Conn_Test.cpp b/tests/Cached_Accept_Conn_Test.cpp
index d442ec36251..c7cedb9c3be 100644
--- a/tests/Cached_Accept_Conn_Test.cpp
+++ b/tests/Cached_Accept_Conn_Test.cpp
@@ -321,9 +321,8 @@ cached_connect (STRATEGY_CONNECTOR &con,
ASYS_TEXT ("connection failed")),
-1);
- // Svc_Handler is now idle, so mark it as such and let the cache
- // recycle it.
- svc_handler->idle (1);
+ // Reset Svc_Handler state.
+ svc_handler->recycle_state (ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE);
return 0;
}
diff --git a/tests/Cached_Conn_Test.cpp b/tests/Cached_Conn_Test.cpp
index e74b250f550..4f277df60e3 100644
--- a/tests/Cached_Conn_Test.cpp
+++ b/tests/Cached_Conn_Test.cpp
@@ -213,7 +213,7 @@ cached_connect (STRATEGY_CONNECTOR &con,
-1);
// Reset Svc_Handler state.
- svc_handler->state (ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE);
+ svc_handler->recycle_state (ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE);
return 0;
}