Transport_Cache_Manager.inl

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

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7