Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# TAO_Transport_Cache_Manager Class Reference

The Transport Cache Manager for TAO. More...

`#include <Transport_Cache_Manager.h>`

Collaboration diagram for TAO_Transport_Cache_Manager:

[legend]
List of all members.

## Public Types
typedef ACE_Hash_Map_Manager< TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Null_Mutex > | HASH_MAP
typedef ACE_Hash_Map_Iterator< TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Null_Mutex > | HASH_MAP_ITER
typedef ACE_Hash_Map_Entry< TAO_Cache_ExtId, TAO_Cache_IntId > | HASH_MAP_ENTRY
## Public Methods
| TAO_Transport_Cache_Manager (TAO_ORB_Core &orb_core)
| Constructor. More...
virtual | ~TAO_Transport_Cache_Manager (void)
| Destructor. More...
int | cache_transport (TAO_Transport_Descriptor_Interface *prop, TAO_Transport *transport)
| Add the transport to the cache. The transport has the property definition based on which caching can be done. More...
int | find_transport (TAO_Transport_Descriptor_Interface *prop, TAO_Transport *&transport)
| Check the Transport Cache to check whether the connection exists in the Cache and return the connection. More...
int | purge (void)
| Remove entries from the cache depending upon the strategy. More...
int | purge_entry (HASH_MAP_ENTRY *&)
| Purge the entry from the Cache Map. More...
void | mark_invalid (HASH_MAP_ENTRY *&)
| Mark the entry as invalid for use but keep it in cache. More...
int | make_idle (HASH_MAP_ENTRY *&entry)
| Make the entry idle and ready for use. More...
int | close (ACE_Handle_Set &reactor_registered, TAO_EventHandlerSet &unregistered)
| Close the underlying hash map manager and return the handle set that have been registered with the reactor. More...
size_t | current_size (void) const
| Return the current size of the cache. More...
size_t | total_size (void) const
| Return the total size of the cache. More...
## Private Types
typedef HASH_MAP_ENTRY ** | DESCRIPTOR_SET
## Private Methods
int | bind (TAO_Cache_ExtId &ext_id, TAO_Cache_IntId &int_id)
| Associate <ext_id> with <int_id>. Grabs the lock and calls the implementation function bind_i. More...
int | find (const TAO_Cache_ExtId &key, TAO_Cache_IntId &value)
| Lookup entry<key,value> in the cache. Grabs the lock and calls the implementation function find_i. More...
int | rebind (const TAO_Cache_ExtId &key, const TAO_Cache_IntId &value)
| Reassociate the <key> with <value>. Grabs the lock and calls the implementation function find_i. More...
int | unbind (const TAO_Cache_ExtId &key)
| Remove <key> from the cache. More...
int | unbind (const TAO_Cache_ExtId &key, TAO_Cache_IntId &value)
| Remove <key> from the cache, and return the <value> associated with <key>. More...
int | bind_i (TAO_Cache_ExtId &ext_id, TAO_Cache_IntId &int_id)
int | find_i (const TAO_Cache_ExtId &key, TAO_Cache_IntId &value)
int | rebind_i (const TAO_Cache_ExtId &key, const TAO_Cache_IntId &value)
| Non-locking version and actual implementation of rebind () call. More...
int | unbind_i (const TAO_Cache_ExtId &key)
| Non-locking version and actual implementation of unbind () call. More...
int | unbind_i (const TAO_Cache_ExtId &key, TAO_Cache_IntId &value)
| Non-locking version and actual implementation of unbind () call. More...
int | make_idle_i (HASH_MAP_ENTRY *&entry)
| Non-locking version and actual implementation of make_idle (). More...
int | close_i (ACE_Handle_Set &reactor_registered, TAO_EventHandlerSet &unregistered)
| Non-locking version and actual implementation of close (). More...
int | purge_entry_i (HASH_MAP_ENTRY *&entry)
| Purge the entry from the Cache Map. More...
void | mark_invalid_i (HASH_MAP_ENTRY *&)
| Mark the entry as invalid for use but keep it in cache. More...
int | get_last_index_bind (TAO_Cache_ExtId &key, TAO_Cache_IntId &val, HASH_MAP_ENTRY *&entry)
int | is_entry_idle (HASH_MAP_ENTRY *&entry)
void | sort_set (DESCRIPTOR_SET &entries, int size)
| Sort the list of entries. More...
int | fill_set_i (DESCRIPTOR_SET &sorted_set)
| Fill sorted_set in with the TAO_Transport_Descriptor_Interface's in a sorted order. More...
void | close_entries (DESCRIPTOR_SET &sorted_set, int size)
| Look through the sorted set and close the connection on the required number of items in the set. More...
## Static Private Methods
int | cpscmp (const void *a, const void *b)
| Used by qsort. More...
## Private Attributes
int | percent_
| The percentage of the cache to purge at one time. More...
TAO_Connection_Purging_Strategy * | purging_strategy_
| The underlying connection purging strategy. More...
HASH_MAP | cache_map_
| The hash map that has the connections. More...
ACE_Lock * | cache_lock_
| Lock for the map. More...

## Detailed Description

The Transport Cache Manager for TAO.

## Member Typedef Documentation

typedef HASH_MAP_ENTRY** TAO_Transport_Cache_Manager::DESCRIPTOR_SET`[private]`

typedef ACE_Hash_Map_Manager<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Null_Mutex> TAO_Transport_Cache_Manager::HASH_MAP

typedef ACE_Hash_Map_Entry<TAO_Cache_ExtId, TAO_Cache_IntId> TAO_Transport_Cache_Manager::HASH_MAP_ENTRY

typedef ACE_Hash_Map_Iterator<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Null_Mutex> TAO_Transport_Cache_Manager::HASH_MAP_ITER

## Constructor & Destructor Documentation

TAO_Transport_Cache_Manager::TAO_Transport_Cache_Manager | ( | TAO_ORB_Core & | orb_core | ) |

| Constructor.

TAO_Transport_Cache_Manager::~TAO_Transport_Cache_Manager | ( | void |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

ACE_INLINE int TAO_Transport_Cache_Manager::bind | ( | TAO_Cache_ExtId & | ext_id,
|  | TAO_Cache_IntId & | int_id
| ) | `[private]`

| Associate <ext_id> with <int_id>. Grabs the lock and calls the implementation function bind_i.

int TAO_Transport_Cache_Manager::bind_i | ( | TAO_Cache_ExtId & | ext_id,
|  | TAO_Cache_IntId & | int_id
| ) | `[private]`

| Non-Locking version and actual implementation of bind () call. Calls bind on the Hash_Map_Manager that it holds. If the bind succeeds, it adds the Hash_Map_Entry in to the Transport for its reference. If the bind fails because of an exiting entry, this method calls the get_last_index_bind ().

ACE_INLINE int TAO_Transport_Cache_Manager::cache_transport | ( | TAO_Transport_Descriptor_Interface * | prop,
|  | TAO_Transport * | transport
| ) |

| Add the transport to the cache. The transport has the property definition based on which caching can be done.

ACE_INLINE int TAO_Transport_Cache_Manager::close | ( | ACE_Handle_Set & | reactor_registered,
|  | TAO_EventHandlerSet & | unregistered
| ) |

| Close the underlying hash map manager and return the handle set that have been registered with the reactor.

void TAO_Transport_Cache_Manager::close_entries | ( | DESCRIPTOR_SET & | sorted_set,
|  | int | sorted_size
| ) | `[private]`

| Look through the sorted set and close the connection on the required number of items in the set.

int TAO_Transport_Cache_Manager::close_i | ( | ACE_Handle_Set & | reactor_registered,
|  | TAO_EventHandlerSet & | unregistered
| ) | `[private]`

| Non-locking version and actual implementation of close ().

int TAO_Transport_Cache_Manager::cpscmp | ( | const void * | a,
|  | const void * | b
| ) | `[static, private]`

| Used by qsort.

ACE_INLINE size_t TAO_Transport_Cache_Manager::current_size | ( | void |  | ) | const

| Return the current size of the cache.

int TAO_Transport_Cache_Manager::fill_set_i | ( | DESCRIPTOR_SET & | sorted_set | ) | `[private]`

| Fill sorted_set in with the TAO_Transport_Descriptor_Interface's in a sorted order.

ACE_INLINE int TAO_Transport_Cache_Manager::find | ( | const TAO_Cache_ExtId & | key,
|  | TAO_Cache_IntId & | value
| ) | `[private]`

| Lookup entry<key,value> in the cache. Grabs the lock and calls the implementation function find_i.

int TAO_Transport_Cache_Manager::find_i | ( | const TAO_Cache_ExtId & | key,
|  | TAO_Cache_IntId & | value
| ) | `[private]`

| Non-locking version and actual implementation of find () call. This calls the find () on the underlying Hash_Map_Manager. If the find succeeds, it calls the get_idle_transport ().

int TAO_Transport_Cache_Manager::find_transport | ( | TAO_Transport_Descriptor_Interface * | prop,
|  | TAO_Transport *& | transport
| ) |

| Check the Transport Cache to check whether the connection exists in the Cache and return the connection.

int TAO_Transport_Cache_Manager::get_last_index_bind | ( | TAO_Cache_ExtId & | key,
|  | TAO_Cache_IntId & | val,
|  | HASH_MAP_ENTRY *& | entry
| ) | `[private]`

| This is called by the bind () call when a bind fails with a available entry. When a new connection is created in TAO with an already existing endpoint, in addition to an exisitng one, we mark the connections with an index. This method, finds out the last highest index and binds the entry with an index = (last highest index + 1).

int TAO_Transport_Cache_Manager::is_entry_idle | ( | HASH_MAP_ENTRY *& | entry | ) | `[private]`

| Tries to find if the <int_id_> in entry is idle for use. If it is idle it is immediately markes as busy and returns a value of 1, else it returns a value of 0

ACE_INLINE int TAO_Transport_Cache_Manager::make_idle | ( | HASH_MAP_ENTRY *& | entry | ) |

| Make the entry idle and ready for use.

int TAO_Transport_Cache_Manager::make_idle_i | ( | HASH_MAP_ENTRY *& | entry | ) | `[private]`

| Non-locking version and actual implementation of make_idle ().

ACE_INLINE void TAO_Transport_Cache_Manager::mark_invalid | ( | HASH_MAP_ENTRY *& | entry | ) |

| Mark the entry as invalid for use but keep it in cache.

void TAO_Transport_Cache_Manager::mark_invalid_i | ( | HASH_MAP_ENTRY *& | entry | ) | `[private]`

| Mark the entry as invalid for use but keep it in cache.

ACE_INLINE int TAO_Transport_Cache_Manager::purge | ( | void |  | ) |

| Remove entries from the cache depending upon the strategy.

ACE_INLINE int TAO_Transport_Cache_Manager::purge_entry | ( | HASH_MAP_ENTRY *& | entry | ) |

| Purge the entry from the Cache Map.

int TAO_Transport_Cache_Manager::purge_entry_i | ( | HASH_MAP_ENTRY *& | entry | ) | `[private]`

| Purge the entry from the Cache Map.

ACE_INLINE int TAO_Transport_Cache_Manager::rebind | ( | const TAO_Cache_ExtId & | key,
|  | const TAO_Cache_IntId & | value
| ) | `[private]`

| Reassociate the <key> with <value>. Grabs the lock and calls the implementation function find_i.

int TAO_Transport_Cache_Manager::rebind_i | ( | const TAO_Cache_ExtId & | key,
|  | const TAO_Cache_IntId & | value
| ) | `[private]`

| Non-locking version and actual implementation of rebind () call.

void TAO_Transport_Cache_Manager::sort_set | ( | DESCRIPTOR_SET & | entries,
|  | int | current_size
| ) | `[private]`

| Sort the list of entries.

ACE_INLINE size_t TAO_Transport_Cache_Manager::total_size | ( | void |  | ) | const

| Return the total size of the cache.

ACE_INLINE int TAO_Transport_Cache_Manager::unbind | ( | const TAO_Cache_ExtId & | key,
|  | TAO_Cache_IntId & | value
| ) | `[private]`

| Remove <key> from the cache, and return the <value> associated with <key>.

ACE_INLINE int TAO_Transport_Cache_Manager::unbind | ( | const TAO_Cache_ExtId & | key | ) | `[private]`

| Remove <key> from the cache.

int TAO_Transport_Cache_Manager::unbind_i | ( | const TAO_Cache_ExtId & | key,
|  | TAO_Cache_IntId & | value
| ) | `[private]`

| Non-locking version and actual implementation of unbind () call.

int TAO_Transport_Cache_Manager::unbind_i | ( | const TAO_Cache_ExtId & | key | ) | `[private]`

| Non-locking version and actual implementation of unbind () call.

## Member Data Documentation

ACE_Lock* TAO_Transport_Cache_Manager::cache_lock_`[private]`

| Lock for the map.

HASH_MAP TAO_Transport_Cache_Manager::cache_map_`[private]`

| The hash map that has the connections.

int TAO_Transport_Cache_Manager::percent_`[private]`

| The percentage of the cache to purge at one time.

TAO_Connection_Purging_Strategy* TAO_Transport_Cache_Manager::purging_strategy_`[private]`

| The underlying connection purging strategy.

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

- Transport_Cache_Manager.h
- Transport_Cache_Manager.cpp
- Transport_Cache_Manager.inl