ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX > Class Template Reference

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>

Inheritance diagram for ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >:

Collaboration graph
[legend]

List of all members.

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.
virtual ~ACE_Bounded_Cached_Connect_Strategy (void)
 Destructor.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

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, int reuse_addr, int flags, int perms, ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, ACE_Pair< SVC_HANDLER *, ATTRIBUTES > > *&entry, int &found)

Protected Attributes

size_t max_size_
 max items in the cache, used as a bound for the creation of svc_handlers.

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


Detailed Description

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
class ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >

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@bandwiz.com> for contributing this class and Susan Liebeskind <shl@janis.gtri.gatech.edu> for brainstorming about it.


Member Typedef Documentation

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX> ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::CCSEBASE [private]

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::REFCOUNTED_HASH_RECYCLABLE_ADDRESS [private]


Constructor & Destructor Documentation

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER, _ACE_PEER_CONNECTOR, 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 
) [inline]

Constructor.

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER, _ACE_PEER_CONNECTOR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::~ACE_Bounded_Cached_Connect_Strategy ( void   )  [inline, virtual]

Destructor.


Member Function Documentation

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER, _ACE_PEER_CONNECTOR, CACHING_STRATEGY, ATTRIBUTES, 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 >, ACE_Pair< SVC_HANDLER *, ATTRIBUTES > > *&  entry,
int &  found 
) [inline, protected, virtual]


Member Data Documentation

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented from ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
size_t ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::max_size_ [protected]

max items in the cache, used as a bound for the creation of svc_handlers.


The documentation for this class was generated from the following files:

Generated on Wed Apr 23 02:38:19 2008 for ACE by  doxygen 1.5.5