3 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 template <typename TT, typename TRDT, typename PSTRAT>
9 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::cache_transport (
10 transport_descriptor_type *prop,
11 transport_type *transport,
12 Cache_Entries_State state)
14 // Compose the ExternId & Intid
15 Cache_ExtId ext_id (prop);
18 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
22 Cache_IntId int_id (transport);
24 // If it has already connected, go directly to the IDLE_BNP state
25 if (int_id.is_connected () && state == ENTRY_CONNECTING)
26 int_id.recycle_state (ENTRY_IDLE_AND_PURGABLE);
28 int_id.recycle_state (state);
30 retval = this->bind_i (ext_id, int_id);
36 template <typename TT, typename TRDT, typename PSTRAT>
38 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::purge_entry (HASH_MAP_ENTRY *&entry)
44 HASH_MAP_ENTRY* cached_entry = 0;
45 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
46 if (entry != 0) // in case someone beat us to it (entry is reference to transport member)
48 // Store the entry in a temporary and zero out the reference.
49 // If there is only one reference count for the transport, we will end up causing
50 // it's destruction. And the transport can not be holding a cache map entry if
55 // now it's save to really purge the entry
56 retval = this->purge_entry_i (cached_entry);
63 template <typename TT, typename TRDT, typename PSTRAT>
65 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::mark_connected (HASH_MAP_ENTRY *&entry, bool state)
67 ACE_MT (ACE_GUARD (ACE_Lock, guard, *this->cache_lock_));
71 if (TAO_debug_level > 9 && state != entry->item ().is_connected ())
72 TAOLIB_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T")
73 ACE_TEXT ("::mark_connected, %s Transport[%d]\n"),
74 (state ? ACE_TEXT("true") : ACE_TEXT("false")),
75 entry->item ().transport ()->id ()));
76 entry->item().is_connected (state);
79 template <typename TT, typename TRDT, typename PSTRAT>
81 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::make_idle (HASH_MAP_ENTRY *&entry)
83 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->cache_lock_, -1));
84 if (entry == 0) // in case someone beat us to it (entry is reference to transport member)
87 return this->make_idle_i (entry);
90 template <typename TT, typename TRDT, typename PSTRAT>
91 ACE_INLINE typename Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::Find_Result
92 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::find (transport_descriptor_type *prop,
93 transport_type *&transport,
96 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
101 return this->find_i (prop, transport, busy_count);
104 template <typename TT, typename TRDT, typename PSTRAT>
106 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::
107 close (Connection_Handler_Set &handlers)
109 // The cache lock pointer should only be zero if
110 // Transport_Cache_Manager_T::open() was never called. Note that
111 // only one thread opens the Transport_Cache_Manager_T at any given
112 // time, so it is safe to check for a non-zero lock pointer.
113 if (this->cache_lock_ == 0)
116 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
121 return this->close_i (handlers);
124 template <typename TT, typename TRDT, typename PSTRAT>
126 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::blockable_client_transports (
127 Connection_Handler_Set &handlers)
129 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
134 return this->blockable_client_transports_i (handlers);
137 template <typename TT, typename TRDT, typename PSTRAT>
139 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::current_size () const
141 return this->cache_map_.current_size ();
144 template <typename TT, typename TRDT, typename PSTRAT>
146 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::total_size () const
148 return this->cache_map_.total_size ();
151 template <typename TT, typename TRDT, typename PSTRAT>
152 ACE_INLINE typename Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::HASH_MAP &
153 Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::map ()
155 return this->cache_map_;
159 TAO_END_VERSIONED_NAMESPACE_DECL