ACE_INet
6.1.1
|
#include <ConnectionCache.h>
typedef ACE_Hash_Map_Entry<ConnectionCacheKey, ConnectionCacheValue> ACE::INet::ConnectionCache::map_entry_type |
typedef ACE_Hash_Map_Manager_Ex<ConnectionCacheKey, ConnectionCacheValue, ACE_Hash<ConnectionCacheKey>, ACE_Equal_To<ConnectionCacheKey>, ACE_SYNCH_NULL_MUTEX> ACE::INet::ConnectionCache::map_type |
ACE::INet::ConnectionCache::ConnectionCache | ( | size_t | size = ACE_DEFAULT_MAP_SIZE | ) |
Constructor.
Destructor.
bool ACE::INet::ConnectionCache::claim_connection | ( | const ConnectionKey & | key, |
connection_type *& | connection, | ||
const factory_type & | connection_factory, | ||
bool | wait = true |
||
) |
Claim a connection from the cache. Creates a new connection using <connection_factory> if the cache does not contain a matching entry for <key>. If <wait> is true and the state of the matching connection is BUSY the method will block waiting for connection to become available. Returns true if a connection could be successfully claimed and sets <connection> to the claimed connection. Returns false otherwise.
bool ACE::INet::ConnectionCache::claim_existing_connection | ( | const ConnectionKey & | key, |
connection_type *& | connection, | ||
ConnectionCacheValue::State & | state | ||
) | [private] |
Attempts to claim an existing connection. Returns true and sets <connection> if successful. Returns false otherwise. Does not wait when no connection available.
Unconditionally closes all active connections.
bool ACE::INet::ConnectionCache::close_connection | ( | const ConnectionKey & | key, |
connection_type * | connection | ||
) |
Close a previously claimed connection. Deletes the actual connection object and marks the cache entry as CLOSED. Returns true is the connection was successfully closed.
size_t ACE::INet::ConnectionCache::current_size | ( | ) | const [inline] |
Returns the number of registered cache entries (including CLOSED).
bool ACE::INet::ConnectionCache::find_connection | ( | const ConnectionKey & | key, |
ConnectionCacheValue & | cacheval | ||
) | [private] |
Looks up a matching cache entry for <key> and updates <cacheval> with the entry state if found. Returns true if found, false otherwise.
bool ACE::INet::ConnectionCache::has_connection | ( | const ConnectionKey & | key | ) |
Returns true if the cache contains a connection matching <key>. Cache entries with state CLOSED are not considered. Returns false otherwise.
bool ACE::INet::ConnectionCache::release_connection | ( | const ConnectionKey & | key, |
connection_type * | connection | ||
) |
Release a previously claimed connection making it available for renewed claiming. Returns true if the connection was successfully released.
bool ACE::INet::ConnectionCache::set_connection | ( | const ConnectionKey & | key, |
const ConnectionCacheValue & | cacheval | ||
) | [private] |
Updates cache entry state.
ACE_SYNCH_MUTEX ACE::INet::ConnectionCache::lock_ [mutable, private] |