Class: ActiveRecord::ConnectionAdapters::ConnectionPool::LeaseRegistry

Inherits:
WeakThreadKeyMap
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/connection_pool.rb,
lib/active_record/connection_adapters/abstract/connection_pool.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from WeakThreadKeyMap

#[]=

Constructor Details

#initializeLeaseRegistry

Returns a new instance of LeaseRegistry.



192
193
194
195
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 192

def initialize
  @mutex = Mutex.new
  @map = WeakThreadKeyMap.new
end

Instance Method Details

#[](context) ⇒ Object

:nodoc:



186
187
188
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 186

def [](context)
  super || (self[context] = Lease.new)
end

#clearObject



203
204
205
206
207
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 203

def clear
  @mutex.synchronize do
    @map.clear
  end
end