TAO 2.0.5
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT > Class Template Reference

The Transport Cache Manager for TAO. More...

#include <Transport_Cache_Manager_T.h>

Collaboration diagram for TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Find_Result { CACHE_FOUND_NONE, CACHE_FOUND_CONNECTING, CACHE_FOUND_BUSY, CACHE_FOUND_AVAILABLE }
 results of a find More...
typedef TT transport_type
typedef TRDT transport_descriptor_type
typedef PSTRAT purging_strategy
typedef Cache_ExtId_T
< transport_descriptor_type
Cache_ExtId
typedef Cache_IntId_T
< transport_type
Cache_IntId
typedef
ACE_Hash_Map_Manager_Ex
< Cache_ExtId, Cache_IntId,
ACE_Hash< Cache_ExtId >
, ACE_Equal_To< Cache_ExtId >
, ACE_Null_Mutex
HASH_MAP
typedef HASH_MAP::iterator HASH_MAP_ITER
typedef ACE_Hash_Map_Entry
< Cache_ExtId, Cache_IntId
HASH_MAP_ENTRY
typedef TAO_Condition
< TAO_SYNCH_MUTEX > 
CONDITION

Public Member Functions

 Transport_Cache_Manager_T (int percent, purging_strategy *purging_strategy, size_t cache_maximum, bool locked, const char *orbid)
 Constructor.
 ~Transport_Cache_Manager_T (void)
 Destructor.
int cache_transport (transport_descriptor_type *prop, transport_type *transport, Cache_Entries_State state=ENTRY_IDLE_AND_PURGABLE)
 Add the transport to the cache.
Find_Result find_transport (transport_descriptor_type *prop, transport_type *&transport, size_t &busy_count)
int purge (void)
 Remove entries from the cache depending upon the strategy.
int purge_entry (HASH_MAP_ENTRY *&entry)
 Purge the entry from the Cache Map.
void mark_connected (HASH_MAP_ENTRY *&entry, bool state)
 Mark the entry as connected.
int make_idle (HASH_MAP_ENTRY *&entry)
 Make the entry idle and ready for use.
void set_entry_state (HASH_MAP_ENTRY *&entry, TAO::Cache_Entries_State state)
 Modify the state setting on the provided entry.
int update_entry (HASH_MAP_ENTRY *&entry)
int close (Connection_Handler_Set &handlers)
bool blockable_client_transports (Connection_Handler_Set &handlers)
size_t current_size (void) const
 Return the current size of the cache.
size_t total_size (void) const
 Return the total size of the cache.
HASH_MAPmap (void)
 Return the underlying cache map.

Private Types

typedef HASH_MAP_ENTRY ** DESCRIPTOR_SET

Private Member Functions

Find_Result find (transport_descriptor_type *prop, transport_type *&transport, size_t &busy_count)
int bind_i (Cache_ExtId &ext_id, Cache_IntId &int_id)
Find_Result find_i (transport_descriptor_type *prop, transport_type *&transport, size_t &busy_count)
int make_idle_i (HASH_MAP_ENTRY *entry)
 Non-locking version and actual implementation of make_idle ().
int close_i (Connection_Handler_Set &handlers)
 Non-locking version and actual implementation of close ()
int purge_entry_i (HASH_MAP_ENTRY *entry)
 Purge the entry from the Cache Map.
bool is_entry_available_i (const HASH_MAP_ENTRY &entry)
bool is_entry_connecting_i (const HASH_MAP_ENTRY &entry)
bool is_entry_purgable_i (HASH_MAP_ENTRY &entry)
void sort_set (DESCRIPTOR_SET &entries, int size)
 Sort the list of entries.
int fill_set_i (DESCRIPTOR_SET &sorted_set)
bool blockable_client_transports_i (Connection_Handler_Set &handlers)
 Non-locking version of blockable_client_transports ().

Static Private Member Functions

static int cpscmp (const void *a, const void *b)
 Used by qsort.

Private Attributes

int percent_
 The percentage of the cache to purge at one time.
purging_strategypurging_strategy_
 The underlying connection purging strategy.
HASH_MAP cache_map_
 The hash map that has the connections.
TAO_SYNCH_MUTEX cache_map_mutex_
ACE_Lockcache_lock_
 The lock that is used by the cache map.
size_t cache_maximum_
 Maximum size of the cache.

Detailed Description

template<typename TT, typename TRDT, typename PSTRAT>
class TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >

The Transport Cache Manager for TAO.

This class provides interfaces associating a TAO_Cache_ExtId & TAO_Cache_IntId. This class is wrapper around the ACE_Hash_Map_Manager class which is used as a container to Cache the connections. This class protects the entries with a lock. The map is updated only by holding the lock. The more compelling reason to have the lock in this class and not in the Hash_Map is that, we do quite a bit of work in this class for which we need a lock.


Member Typedef Documentation

template<typename TT , typename TRDT , typename PSTRAT >
typedef Cache_ExtId_T<transport_descriptor_type> TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Cache_ExtId
template<typename TT , typename TRDT , typename PSTRAT >
typedef Cache_IntId_T<transport_type> TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Cache_IntId
template<typename TT , typename TRDT , typename PSTRAT >
typedef TAO_Condition<TAO_SYNCH_MUTEX> TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::CONDITION
template<typename TT , typename TRDT , typename PSTRAT >
typedef HASH_MAP_ENTRY** TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::DESCRIPTOR_SET [private]
template<typename TT , typename TRDT , typename PSTRAT >
typedef ACE_Hash_Map_Manager_Ex<Cache_ExtId, Cache_IntId, ACE_Hash<Cache_ExtId>, ACE_Equal_To<Cache_ExtId>, ACE_Null_Mutex> TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::HASH_MAP
template<typename TT , typename TRDT , typename PSTRAT >
typedef ACE_Hash_Map_Entry<Cache_ExtId, Cache_IntId> TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::HASH_MAP_ENTRY
template<typename TT , typename TRDT , typename PSTRAT >
typedef HASH_MAP::iterator TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::HASH_MAP_ITER
template<typename TT , typename TRDT , typename PSTRAT >
typedef PSTRAT TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::purging_strategy
template<typename TT , typename TRDT , typename PSTRAT >
typedef TRDT TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::transport_descriptor_type
template<typename TT , typename TRDT , typename PSTRAT >
typedef TT TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::transport_type

Member Enumeration Documentation

template<typename TT , typename TRDT , typename PSTRAT >
enum TAO::Transport_Cache_Manager_T::Find_Result

results of a find

Enumerator:
CACHE_FOUND_NONE 
CACHE_FOUND_CONNECTING 
CACHE_FOUND_BUSY 
CACHE_FOUND_AVAILABLE 

Constructor & Destructor Documentation

template<typename TT , typename TRDT , typename PSTRAT >
TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Transport_Cache_Manager_T ( int  percent,
purging_strategy purging_strategy,
size_t  cache_maximum,
bool  locked,
const char *  orbid 
)

Constructor.

template<typename TT , typename TRDT , typename PSTRAT >
TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::~Transport_Cache_Manager_T ( void  )

Destructor.


Member Function Documentation

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::bind_i ( Cache_ExtId ext_id,
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.

template<typename TT , typename TRDT , typename PSTRAT >
bool TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::blockable_client_transports ( Connection_Handler_Set handlers)

Return a set of connection handlers that belong to transports that have a RW wait strategy. This call is used for a specific use case by the ORB_Core during shutdown. The only way the ORB can wake up threads waiting on these sockets for replies is to iterate over these blockable transports and close the socket handles. Without these the threads will continue to wait there for ever.

template<typename TT , typename TRDT , typename PSTRAT >
bool TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::blockable_client_transports_i ( Connection_Handler_Set handlers) [private]

Non-locking version of blockable_client_transports ().

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cache_transport ( transport_descriptor_type prop,
transport_type transport,
Cache_Entries_State  state = ENTRY_IDLE_AND_PURGABLE 
)

Add the transport to the cache.

The transport has the property definition based on which caching can be done. This method sets the cache entry status. By default the status is set to ENTRY_IDLE_AND_PURGABLE

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::close ( Connection_Handler_Set handlers)

Close the underlying hash map manager and return any handlers still registered

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::close_i ( Connection_Handler_Set handlers) [private]

Non-locking version and actual implementation of close ()

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cpscmp ( const void *  a,
const void *  b 
) [static, private]

Used by qsort.

template<typename TT , typename TRDT , typename PSTRAT >
size_t TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::current_size ( void  ) const

Return the current size of the cache.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::fill_set_i ( DESCRIPTOR_SET sorted_set) [private]

Fill sorted_set in with the transport_descriptor_type's in a sorted order.

template<typename TT , typename TRDT , typename PSTRAT >
Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Find_Result TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::find ( transport_descriptor_type prop,
transport_type *&  transport,
size_t &  busy_count 
) [private]

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

template<typename TT , typename TRDT , typename PSTRAT >
Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Find_Result TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::find_i ( transport_descriptor_type prop,
transport_type *&  transport,
size_t &  busy_count 
) [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 ().

template<typename TT , typename TRDT , typename PSTRAT >
Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::Find_Result TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::find_transport ( transport_descriptor_type prop,
transport_type *&  transport,
size_t &  busy_count 
)

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

template<typename TT , typename TRDT , typename PSTRAT >
bool TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::is_entry_available_i ( const HASH_MAP_ENTRY entry) [private]

Tries to find if the int_id_ in entry is available for use.

template<typename TT , typename TRDT , typename PSTRAT >
bool TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::is_entry_connecting_i ( const HASH_MAP_ENTRY entry) [private]

Tries to find if the int_id_ in entry is connect pending

template<typename TT , typename TRDT , typename PSTRAT >
bool TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::is_entry_purgable_i ( HASH_MAP_ENTRY entry) [private]

Tries to find if the int_id_ in entry is purgable

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::make_idle ( HASH_MAP_ENTRY *&  entry)

Make the entry idle and ready for use.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::make_idle_i ( HASH_MAP_ENTRY entry) [private]

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

template<typename TT , typename TRDT , typename PSTRAT >
Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::HASH_MAP & TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::map ( void  )

Return the underlying cache map.

template<typename TT , typename TRDT , typename PSTRAT >
void TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::mark_connected ( HASH_MAP_ENTRY *&  entry,
bool  state 
)

Mark the entry as connected.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::purge ( void  )

Remove entries from the cache depending upon the strategy.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::purge_entry ( HASH_MAP_ENTRY *&  entry)

Purge the entry from the Cache Map.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::purge_entry_i ( HASH_MAP_ENTRY entry) [private]

Purge the entry from the Cache Map.

template<typename TT , typename TRDT , typename PSTRAT >
void TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::set_entry_state ( HASH_MAP_ENTRY *&  entry,
TAO::Cache_Entries_State  state 
)

Modify the state setting on the provided entry.

template<typename TT , typename TRDT , typename PSTRAT >
void TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::sort_set ( DESCRIPTOR_SET entries,
int  size 
) [private]

Sort the list of entries.

template<typename TT , typename TRDT , typename PSTRAT >
size_t TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::total_size ( void  ) const

Return the total size of the cache.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::update_entry ( HASH_MAP_ENTRY *&  entry)

Mark the entry as touched. This call updates the purging strategy policy information.


Member Data Documentation

template<typename TT , typename TRDT , typename PSTRAT >
ACE_Lock* TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cache_lock_ [private]

The lock that is used by the cache map.

template<typename TT , typename TRDT , typename PSTRAT >
HASH_MAP TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cache_map_ [private]

The hash map that has the connections.

template<typename TT , typename TRDT , typename PSTRAT >
TAO_SYNCH_MUTEX TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cache_map_mutex_ [private]
template<typename TT , typename TRDT , typename PSTRAT >
size_t TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::cache_maximum_ [private]

Maximum size of the cache.

template<typename TT , typename TRDT , typename PSTRAT >
int TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::percent_ [private]

The percentage of the cache to purge at one time.

template<typename TT , typename TRDT , typename PSTRAT >
purging_strategy* TAO::Transport_Cache_Manager_T< TT, TRDT, PSTRAT >::purging_strategy_ [private]

The underlying connection purging strategy.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines