ACE_Cached_Connect_Strategy_Ex< 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. More...

#include <Cached_Connect_Strategy_T.h>

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

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

Collaboration graph
[legend]
List of all members.

Public Types

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 > 
CONNECTION_CACHE
typedef CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY
typedef CONNECTION_CACHE::key_type KEY
typedef CONNECTION_CACHE::mapped_type VALUE
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

Public Member Functions

 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.
virtual ~ACE_Cached_Connect_Strategy_Ex (void)
 Destructor.
virtual int purge_connections (void)
 Explicit purging of connection entries from the connection cache.
virtual int mark_as_closed_i (const void *recycling_act)
void cleanup (void)
CACHING_STRATEGY & caching_strategy (void)

Protected Member Functions

int find (ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR > &search_addr, ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, ACE_Pair< SVC_HANDLER *, ATTRIBUTES > > *&entry)
 Find an idle handle.
virtual int purge_i (const void *recycling_act)
 Remove from cache (non-locking version).
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)
 Get/Set <recycle_state> (non-locking version).
virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const
 Get <recycle_state> (non-locking version).
virtual int cleanup_hint_i (const void *recycling_act, void **act_holder)
 Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>.
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, 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)
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)
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)
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, int reuse_addr, int flags, int perms)

Protected Attributes

CONNECTION_CACHE connection_cache_
 Table that maintains the cache of connected SVC_HANDLERs.

Detailed Description

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
class ACE_Cached_Connect_Strategy_Ex< 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.

<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.

Definition at line 48 of file Cached_Connect_Strategy_T.h.


Member Typedef Documentation

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX> ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::CCSBASE

Definition at line 102 of file Cached_Connect_Strategy_T.h.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
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> > ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::CLEANUP_STRATEGY

Definition at line 99 of file Cached_Connect_Strategy_T.h.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
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> ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::CONNECTION_CACHE

Definition at line 87 of file Cached_Connect_Strategy_T.h.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef CONNECTION_CACHE::CACHE_ENTRY ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::CONNECTION_CACHE_ENTRY

Definition at line 88 of file Cached_Connect_Strategy_T.h.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef CONNECTION_CACHE::key_type ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::KEY

Definition at line 89 of file Cached_Connect_Strategy_T.h.

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_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::REFCOUNTED_HASH_RECYCLABLE_ADDRESS

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Reimplemented in ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >.

Definition at line 80 of file Cached_Connect_Strategy_T.h.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
typedef CONNECTION_CACHE::mapped_type ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::VALUE

Definition at line 90 of file Cached_Connect_Strategy_T.h.


Constructor & Destructor Documentation

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::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.

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

Destructor.

Definition at line 42 of file Cached_Connect_Strategy_T.cpp.

References ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup().

00043 {
00044   cleanup ();
00045 }


Member Function Documentation

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cache_i ( const void *  recycling_act  )  [protected, virtual]

Add to cache (non-locking version).

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 374 of file Cached_Connect_Strategy_T.cpp.

References ACE_RECYCLABLE_IDLE_AND_PURGABLE.

00375 {
00376   // The wonders and perils of ACT
00377   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00378 
00379   // Mark the <svc_handler> in the cache as not being <in_use>.
00380   // Therefore recyclable is IDLE.
00381   entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE);
00382 
00383   return 0;
00384 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, 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 
) [protected, virtual]

Connection of the svc_handler with the remote host. This method also encapsulates the connection done with auto_purging under the hood. If the connect failed due to the process running out of file descriptors then, auto_purging of some connections are done from the CONNECTION_CACHE. This frees the descriptors which get used in the connect process and hence the connect operation can succeed.

Definition at line 255 of file Cached_Connect_Strategy_T.cpp.

References ENOTSUP, and ACE::out_of_handles().

00262 {
00263   // Actively establish the connection.  This is a timed blocking
00264   // connect.
00265   if (this->new_connection (sh,
00266                             remote_addr,
00267                             timeout,
00268                             local_addr,
00269                             reuse_addr,
00270                             flags,
00271                             perms) == -1)
00272     {
00273       // If connect() failed because of timeouts, we have to reject
00274       // the connection entirely. This is necessary since currently
00275       // there is no way for the non-blocking connects to complete and
00276       // for the <Connector> to notify the cache of the completion of
00277       // connect().
00278 
00279       if (errno == EWOULDBLOCK || errno == ETIMEDOUT)
00280         errno = ENOTSUP;
00281       else if (ACE::out_of_handles (errno) || errno == EADDRINUSE)
00282         {
00283           // If the connect failed due to the process running out of
00284           // file descriptors then, auto_purging of some connections
00285           // are done from the CONNECTION_CACHE. This frees the
00286           // descriptors which get used in the connect process and
00287           // hence the same method is called again!
00288           if (this->purge_connections () == -1)
00289             return -1;
00290 
00291           // Try connecting again.
00292           if (this->new_connection (sh,
00293                                     remote_addr,
00294                                     timeout,
00295                                     local_addr,
00296                                     reuse_addr,
00297                                     flags,
00298                                     perms) == -1)
00299             {
00300               if (errno == EWOULDBLOCK || errno == ETIMEDOUT)
00301                 errno = ENOTSUP;
00302               return -1;
00303             }
00304         }
00305       else
00306         {
00307           return -1;
00308         }
00309     }
00310 
00311   return 0;
00312 
00313 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
CACHING_STRATEGY & ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::caching_strategy ( void   ) 

Definition at line 468 of file Cached_Connect_Strategy_T.cpp.

References ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::connection_cache_.

00469 {
00470   return this->connection_cache_.caching_strategy ();
00471 }

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

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
void ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup ( void   ) 

Since g++ version < 2.8 arent happy with templates, this special method had to be devised to avoid memory leaks and perform cleanup of the <connection_cache_>.

Definition at line 527 of file Cached_Connect_Strategy_T.cpp.

References ACE_GUARD, ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::connection_cache_, and ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_i().

Referenced by ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::~ACE_Cached_Connect_Strategy_Ex().

00528 {
00529   // Excluded other threads from changing the cache while we cleanup
00530   ACE_GUARD (MUTEX, ace_mon, *this->lock_);
00531 
00532   // Close down all cached service handlers.
00533   typename CONNECTION_CACHE::ITERATOR iter = this->connection_cache_.begin ();
00534   while (iter != this->connection_cache_.end ())
00535     {
00536       if ((*iter).second () != 0)
00537         {
00538           // save entry for future use
00539           CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *)
00540             (*iter).second ()->recycling_act ();
00541 
00542           // close handler
00543           (*iter).second ()->recycler (0, 0);
00544           (*iter).second ()->close ();
00545 
00546           // remember next iter
00547           typename CONNECTION_CACHE::ITERATOR next_iter = iter;
00548           ++next_iter;
00549 
00550           // purge the item from the hash
00551           this->purge_i (entry);
00552 
00553           // assign next iter
00554           iter  = next_iter;
00555         }
00556      else
00557        ++iter;
00558     }
00559 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup_hint_i ( const void *  recycling_act,
void **  act_holder 
) [protected, virtual]

Cleanup hint and reset <*act_holder> to zero if <act_holder != 0>.

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 434 of file Cached_Connect_Strategy_T.cpp.

References ACE_RECYCLABLE_CLOSED, and ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_i().

00436 {
00437   // Reset the <*act_holder> in the confines and protection of the
00438   // lock.
00439   if (act_holder)
00440     *act_holder = 0;
00441 
00442   // The wonders and perils of ACT
00443   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00444 
00445   // Decrement the refcount on the <svc_handler>.
00446   int refcount = entry->ext_id_.decrement ();
00447 
00448   // If the svc_handler state is closed and the refcount == 0, call
00449   // close() on svc_handler.
00450   if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED &&
00451       refcount == 0)
00452     {
00453       entry->int_id_.first ()->recycler (0, 0);
00454       entry->int_id_.first ()->close ();
00455       this->purge_i (entry);
00456     }
00457 
00458   return 0;
00459 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, 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 
) [protected, virtual]

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 318 of file Cached_Connect_Strategy_T.cpp.

References ACE_RECYCLABLE_BUSY.

00326 {
00327   CONNECTION_CACHE_ENTRY *entry = 0;
00328 
00329   // Check if the user passed a hint svc_handler
00330   if (sh != 0)
00331     {
00332       int result = this->check_hint_i (sh,
00333                                        remote_addr,
00334                                        timeout,
00335                                        local_addr,
00336                                        reuse_addr,
00337                                        flags,
00338                                        perms,
00339                                        entry,
00340                                        found);
00341       if (result != 0)
00342         return result;
00343     }
00344 
00345   // If not found
00346   if (!found)
00347     {
00348       int result = this->find_or_create_svc_handler_i (sh,
00349                                                        remote_addr,
00350                                                        timeout,
00351                                                        local_addr,
00352                                                        reuse_addr,
00353                                                        flags,
00354                                                        perms,
00355                                                        entry,
00356                                                        found);
00357 
00358       if (result != 0)
00359         return result;
00360 
00361       // Increment the refcount
00362       entry->ext_id_.increment ();
00363     }
00364 
00365   // For all successful cases: mark the <svc_handler> in the cache
00366   // as being <in_use>.  Therefore recyclable is BUSY.
00367   entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY);
00368 
00369   return 0;
00370 }

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::find ( ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR > &  search_addr,
ACE_Hash_Map_Entry< ACE_Refcounted_Hash_Recyclable< ACE_PEER_CONNECTOR_ADDR >, ACE_Pair< SVC_HANDLER *, ATTRIBUTES > > *&  entry 
) [protected]

Find an idle handle.

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
virtual int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, 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 
) [protected, virtual]

Reimplemented in ACE_Bounded_Cached_Connect_Strategy< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >.

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::mark_as_closed_i ( const void *  recycling_act  )  [virtual]

Mark as closed (non-locking version). This is used during the cleanup of the connections purged.

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 422 of file Cached_Connect_Strategy_T.cpp.

References ACE_RECYCLABLE_CLOSED.

00423 {
00424   // The wonders and perils of ACT
00425   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00426 
00427   // Mark the <svc_handler> in the cache as CLOSED.
00428   entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED);
00429 
00430   return 0;
00431 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_connections ( void   )  [virtual]

Explicit purging of connection entries from the connection cache.

Definition at line 462 of file Cached_Connect_Strategy_T.cpp.

References ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::connection_cache_.

00463 {
00464   return this->connection_cache_.purge ();
00465 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_i ( const void *  recycling_act  )  [protected, virtual]

Remove from cache (non-locking version).

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 412 of file Cached_Connect_Strategy_T.cpp.

References ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::connection_cache_, and ACE_Hash_Cache_Map_Manager< KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES >::unbind().

Referenced by ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup(), and ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup_hint_i().

00413 {
00414   // The wonders and perils of ACT
00415   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00416 
00417   return this->connection_cache_.unbind (entry);
00418 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Recyclable_State ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::recycle_state_i ( const void *  recycling_act  )  const [protected, virtual]

Get <recycle_state> (non-locking version).

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 401 of file Cached_Connect_Strategy_T.cpp.

00402 {
00403   // The wonders and perils of ACT
00404   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00405 
00406   // Mark the <svc_handler> in the cache as not being <in_use>.
00407   // Therefore recyclable is IDLE.
00408   return entry->ext_id_.recycle_state ();
00409 }

template<class SVC_HANDLER, class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER, _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::recycle_state_i ( const void *  recycling_act,
ACE_Recyclable_State  new_state 
) [protected, virtual]

Get/Set <recycle_state> (non-locking version).

Reimplemented from ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >.

Definition at line 387 of file Cached_Connect_Strategy_T.cpp.

00389 {
00390   // The wonders and perils of ACT
00391   CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
00392 
00393   // Mark the <svc_handler> in the cache as not being <in_use>.
00394   // Therefore recyclable is IDLE.
00395   entry->ext_id_.recycle_state (new_state);
00396 
00397   return 0;
00398 }


Member Data Documentation

template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1 , class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
CONNECTION_CACHE ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::connection_cache_ [protected]

Table that maintains the cache of connected SVC_HANDLERs.

Definition at line 176 of file Cached_Connect_Strategy_T.h.

Referenced by ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::caching_strategy(), ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::cleanup(), ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_connections(), and ACE_Cached_Connect_Strategy_Ex< SVC_HANDLER,, CACHING_STRATEGY, ATTRIBUTES, MUTEX >::purge_i().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:34:58 2010 for ACE by  doxygen 1.4.7