ACE
6.3.1
|
A connection strategy which caches connections to peers (represented by SVC_HANDLER instances), thereby allowing subsequent re-use of unused, but available, connections. This strategy should be used when the cache is bounded by maximum size. More...
#include <Cached_Connect_Strategy_T.h>
Public Member Functions | |
ACE_Bounded_Cached_Connect_Strategy (size_t max_size, CACHING_STRATEGY &caching_s, ACE_Creation_Strategy< SVC_HANDLER > *cre_s=0, ACE_Concurrency_Strategy< SVC_HANDLER > *con_s=0, ACE_Recycling_Strategy< SVC_HANDLER > *rec_s=0, MUTEX *lock=0, int delete_lock=0) | |
Constructor. More... | |
virtual | ~ACE_Bounded_Cached_Connect_Strategy (void) |
Destructor. More... | |
![]() | |
ACE_Cached_Connect_Strategy_Ex (CACHING_STRATEGY &caching_s, ACE_Creation_Strategy< SVC_HANDLER > *cre_s=0, ACE_Concurrency_Strategy< SVC_HANDLER > *con_s=0, ACE_Recycling_Strategy< SVC_HANDLER > *rec_s=0, MUTEX *lock=0, int delete_lock=0) | |
Constructor. More... | |
virtual | ~ACE_Cached_Connect_Strategy_Ex (void) |
Destructor. More... | |
virtual int | purge_connections (void) |
Explicit purging of connection entries from the connection cache. More... | |
virtual int | mark_as_closed_i (const void *recycling_act) |
void | cleanup (void) |
CACHING_STRATEGY & | caching_strategy (void) |
![]() | |
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, MUTEX *mutex=0, bool delete_lock=false) | |
Constructor. More... | |
virtual | ~ACE_Cached_Connect_Strategy (void) |
Destructor. More... | |
virtual int | open (ACE_Creation_Strategy< SVC_HANDLER > *cre_s, ACE_Concurrency_Strategy< SVC_HANDLER > *con_s, ACE_Recycling_Strategy< SVC_HANDLER > *rec_s) |
virtual int | make_svc_handler (SVC_HANDLER *&sh) |
Template method for making a new <svc_handler> More... | |
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler) |
Template method for activating a new svc_handler. More... | |
virtual int | assign_recycler (SVC_HANDLER *svc_handler, ACE_Connection_Recycling_Strategy *recycler, const void *recycling_act) |
virtual int | prepare_for_recycling (SVC_HANDLER *svc_handler) |
Template method for preparing the svc_handler for recycling. More... | |
virtual int | connect_svc_handler (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms) |
virtual int | 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, bool reuse_addr, int flags, int perms) |
virtual int | purge (const void *recycling_act) |
Remove from cache. More... | |
virtual int | cache (const void *recycling_act) |
Add to cache. More... | |
virtual int | recycle_state (const void *recycling_act, ACE_Recyclable_State new_state) |
Get/Set <recycle_state>. More... | |
virtual ACE_Recyclable_State | recycle_state (const void *recycling_act) const |
Get/Set recycle_state. More... | |
virtual int | mark_as_closed (const void *recycling_act) |
Mark as closed. More... | |
virtual int | cleanup_hint (const void *recycling_act, void **act_holder=0) |
Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>. More... | |
virtual ACE_Creation_Strategy < SVC_HANDLER > * | creation_strategy (void) const |
virtual ACE_Recycling_Strategy < SVC_HANDLER > * | recycling_strategy (void) const |
virtual ACE_Concurrency_Strategy < SVC_HANDLER > * | concurrency_strategy (void) const |
![]() | |
ACE_Connection_Recycling_Strategy (void) | |
virtual | ~ACE_Connection_Recycling_Strategy (void) |
Virtual Destructor. More... | |
![]() | |
ACE_Connect_Strategy (void) | |
Default constructor. More... | |
virtual ACE_PEER_CONNECTOR & | connector (void) const |
Return a reference to the <peer_connector_>. More... | |
virtual | ~ACE_Connect_Strategy (void) |
void | dump (void) const |
Dump the state of an object. More... | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. More... | |
![]() | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. More... | |
Protected Member Functions | |
virtual int | 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, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, std::pair< SVC_HANDLER *, ATTRIBUTES > > *&entry, int &found) |
![]() | |
int | find (ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR > &search_addr, ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, std::pair< SVC_HANDLER *, ATTRIBUTES > > *&entry) |
Find an idle handle. More... | |
virtual int | purge_i (const void *recycling_act) |
Remove from cache (non-locking version). More... | |
virtual int | cache_i (const void *recycling_act) |
Add to cache (non-locking version). More... | |
virtual int | recycle_state_i (const void *recycling_act, ACE_Recyclable_State new_state) |
Get/Set recycle_state (non-locking version). More... | |
virtual ACE_Recyclable_State | recycle_state_i (const void *recycling_act) const |
Get <recycle_state> (non-locking version). More... | |
virtual int | cleanup_hint_i (const void *recycling_act, void **act_holder) |
Cleanup hint and reset *act_holder to zero if act_holder != 0. More... | |
int | check_hint_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, std::pair< SVC_HANDLER *, ATTRIBUTES > > *&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, bool reuse_addr, int flags, int perms, int &found) |
virtual int | cached_connect (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms) |
![]() | |
virtual int | new_connection (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms) |
Creates a new connection. More... | |
int | find (REFCOUNTED_HASH_RECYCLABLE_ADDRESS &search_addr, CONNECTION_MAP_ENTRY *&entry) |
Find an idle handle. More... | |
int | check_hint_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, CONNECTION_MAP_ENTRY *&entry, int &found) |
int | 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, bool reuse_addr, int flags, int perms, CONNECTION_MAP_ENTRY *&entry, int &found) |
Protected Attributes | |
size_t | max_size_ |
Max items in the cache, used as a bound for the creation of svc_handlers. More... | |
![]() | |
CONNECTION_CACHE | connection_cache_ |
Table that maintains the cache of connected SVC_HANDLERs. More... | |
![]() | |
CONNECTION_MAP | connection_map_ |
Table that maintains the cache of connected SVC_HANDLERs. More... | |
MUTEX * | lock_ |
Mutual exclusion for this object. More... | |
bool | delete_lock_ |
Mutual exclusion for this object. More... | |
REVERSE_MUTEX * | reverse_lock_ |
Reverse lock. More... | |
CREATION_STRATEGY * | creation_strategy_ |
Creation strategy for an <Connector>. More... | |
bool | delete_creation_strategy_ |
CONCURRENCY_STRATEGY * | concurrency_strategy_ |
Concurrency strategy for an <Connector>. More... | |
bool | delete_concurrency_strategy_ |
RECYCLING_STRATEGY * | recycling_strategy_ |
Recycling strategy for an <Connector>. More... | |
bool | delete_recycling_strategy_ |
![]() | |
ACE_PEER_CONNECTOR | connector_ |
Factory that establishes connections actively. More... | |
Private Types | |
typedef ACE_Cached_Connect_Strategy_Ex < SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX > | CCSEBASE |
typedef ACE_Refcounted_Hash_Recyclable < ACE_PEER_CONNECTOR_ADDR > | REFCOUNTED_HASH_RECYCLABLE_ADDRESS |
A connection strategy which caches connections to peers (represented by SVC_HANDLER instances), thereby allowing subsequent re-use of unused, but available, connections. This strategy should be used when the cache is bounded by maximum size.
Bounded_Cached_Connect_Strategy is intended to be used as a plug-in connection strategy for ACE_Strategy_Connector. It's added value is re-use of established connections and tweaking the role of the cache as per the caching strategy. Thanks to Edan Ayal edana for contributing this class and Susan Liebeskind @ban dwiz. comshl@j for brainstorming about it. anis .gtri .gat ech.e du
|
private |
|
private |
ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_1, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::ACE_Bounded_Cached_Connect_Strategy | ( | size_t | max_size, |
CACHING_STRATEGY & | caching_s, | ||
ACE_Creation_Strategy< SVC_HANDLER > * | cre_s = 0 , |
||
ACE_Concurrency_Strategy< SVC_HANDLER > * | con_s = 0 , |
||
ACE_Recycling_Strategy< SVC_HANDLER > * | rec_s = 0 , |
||
MUTEX * | lock = 0 , |
||
int | delete_lock = 0 |
||
) |
Constructor.
|
virtual |
Destructor.
|
protectedvirtual |
ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_1, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
protected |
Max items in the cache, used as a bound for the creation of svc_handlers.