Transport_Cache_Manager.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //Transport_Cache_Manager.inl,v 1.13 2005/11/02 11:03:27 ossama Exp
00004 
00005 
00006 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00007 
00008 namespace TAO
00009 {
00010   ACE_INLINE int
00011   Transport_Cache_Manager::bind (Cache_ExtId &ext_id,
00012                                  Cache_IntId &int_id)
00013   {
00014     ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00015                               guard,
00016                               *this->cache_lock_,
00017                               -1));
00018 
00019     return this->bind_i (ext_id,
00020                          int_id);
00021   }
00022 
00023   ACE_INLINE int
00024   Transport_Cache_Manager::cache_transport (
00025     TAO_Transport_Descriptor_Interface *prop,
00026     TAO_Transport *transport)
00027   {
00028     // Compose the ExternId & Intid
00029     Cache_ExtId ext_id (prop);
00030     Cache_IntId int_id (transport);
00031 
00032     int retval = 0;
00033     {
00034       ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00035                                 guard,
00036                                 *this->cache_lock_,
00037                                 -1));
00038 
00039       // Do as the semantics of this method dictates
00040       int_id.recycle_state (ENTRY_BUSY);
00041 
00042       retval = this->bind_i (ext_id,
00043                              int_id);
00044     }
00045 
00046     return retval;
00047   }
00048 
00049   ACE_INLINE int
00050   Transport_Cache_Manager::cache_idle_transport (
00051     TAO_Transport_Descriptor_Interface *prop,
00052     TAO_Transport *transport)
00053   {
00054     // Compose the ExternId & Intid
00055     Cache_ExtId ext_id (prop);
00056     Cache_IntId int_id (transport);
00057 
00058     int retval = 0;
00059     {
00060       ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00061                                 guard,
00062                                 *this->cache_lock_,
00063                                 -1));
00064 
00065       // Do as the semantics of this method dictates
00066       int_id.recycle_state (ENTRY_IDLE_AND_PURGABLE);
00067       retval = this->bind_i (ext_id,
00068                              int_id);
00069     }
00070 
00071     return retval;
00072   }
00073 
00074   ACE_INLINE int
00075   Transport_Cache_Manager::purge_entry (HASH_MAP_ENTRY *&entry)
00076   {
00077     // Double checked locking
00078     if(entry == 0)
00079       return 0;
00080 
00081     ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
00082 
00083     return this->purge_entry_i (entry);
00084   }
00085 
00086   ACE_INLINE void
00087   Transport_Cache_Manager::mark_invalid (HASH_MAP_ENTRY *&entry)
00088   {
00089     if(entry == 0)
00090       return;
00091 
00092     // Double checked locking
00093     ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->cache_lock_));
00094 
00095     this->mark_invalid_i (entry);
00096   }
00097 
00098   ACE_INLINE int
00099   Transport_Cache_Manager::make_idle (HASH_MAP_ENTRY *&entry)
00100   {
00101     if(entry == 0)
00102       return -1;
00103 
00104     ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
00105     return this->make_idle_i (entry);
00106   }
00107 
00108   ACE_INLINE int
00109   Transport_Cache_Manager::close (Connection_Handler_Set &handlers)
00110   {
00111     // The cache lock pointer should only be zero if
00112     // Transport_Cache_Manager::open() was never called.  Note that
00113     // only one thread opens the Transport_Cache_Manager at any given
00114     // time, so it is safe to check for a non-zero lock pointer.
00115     if (this->cache_lock_ == 0)
00116       return -1;
00117 
00118     ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00119                               guard,
00120                               *this->cache_lock_,
00121                               -1));
00122 
00123     return this->close_i (handlers);
00124   }
00125 
00126   ACE_INLINE bool
00127   Transport_Cache_Manager::blockable_client_transports (
00128     Connection_Handler_Set &handlers)
00129   {
00130     ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00131                               guard,
00132                               *this->cache_lock_,
00133                               false));
00134 
00135     return this->blockable_client_transports_i (handlers);
00136   }
00137 
00138   ACE_INLINE size_t
00139   Transport_Cache_Manager::current_size (void) const
00140   {
00141     return this->cache_map_.current_size ();
00142   }
00143 
00144   ACE_INLINE size_t
00145   Transport_Cache_Manager::total_size (void) const
00146   {
00147     return this->cache_map_.total_size ();
00148   }
00149 
00150   ACE_INLINE Transport_Cache_Manager::HASH_MAP &
00151   Transport_Cache_Manager::map (void)
00152   {
00153     return this->cache_map_;
00154   }
00155 }
00156 
00157 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 11:54:26 2006 for TAO by doxygen 1.3.6