Class: ActiveRecord::ConnectionAdapters::ConnectionPool::LeaseRegistry
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::ConnectionPool::LeaseRegistry
- Defined in:
- lib/active_record/connection_adapters/abstract/connection_pool.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](context) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ LeaseRegistry
constructor
A new instance of LeaseRegistry.
Constructor Details
#initialize ⇒ LeaseRegistry
Returns a new instance of LeaseRegistry.
168 169 170 171 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 168 def initialize @mutex = Mutex.new @map = WeakThreadKeyMap.new end |
Instance Method Details
#[](context) ⇒ Object
173 174 175 176 177 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 173 def [](context) @mutex.synchronize do @map[context] ||= Lease.new end end |
#clear ⇒ Object
179 180 181 182 183 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 179 def clear @mutex.synchronize do @map.clear end end |