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

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeLeaseRegistry

Returns a new instance of LeaseRegistry.



169
170
171
172
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 169

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

Instance Method Details

#[](context) ⇒ Object



174
175
176
177
178
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 174

def [](context)
  @mutex.synchronize do
    @map[context] ||= Lease.new
  end
end

#clearObject



180
181
182
183
184
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 180

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