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:
Defined Under Namespace
Classes: WeakKeyMap
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.
187 188 189 190 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 187 def initialize @mutex = Mutex.new @map = WeakKeyMap.new end |
Instance Method Details
#[](context) ⇒ Object
192 193 194 195 196 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 192 def [](context) @mutex.synchronize do @map[context] ||= Lease.new end end |
#clear ⇒ Object
198 199 200 201 202 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 198 def clear @mutex.synchronize do @map = WeakKeyMap.new end end |