Module: ActiveRecord::Bogacs::PoolSupport
- Included in:
- DefaultPool, FalsePool, ShareablePool
- Defined in:
- lib/active_record/bogacs/pool_support.rb
Instance Method Summary collapse
- #current_connection_id ⇒ Object
-
#new_connection ⇒ Object
end.
-
#reap ⇒ Object
clear_stale_cached_connections! without the deprecation :.
- #remove(conn) ⇒ Object
Instance Method Details
#current_connection_id ⇒ Object
14 15 16 17 |
# File 'lib/active_record/bogacs/pool_support.rb', line 14 def current_connection_id # NOTE: possible fiber work-around on JRuby ?! Base.connection_id ||= Thread.current.object_id end |
#new_connection ⇒ Object
end
10 11 12 |
# File 'lib/active_record/bogacs/pool_support.rb', line 10 def new_connection Base.send(spec.adapter_method, spec.config) end |
#reap ⇒ Object
clear_stale_cached_connections! without the deprecation :
28 29 30 31 32 33 34 35 36 |
# File 'lib/active_record/bogacs/pool_support.rb', line 28 def reap keys = @reserved_connections.keys - Thread.list.find_all { |t| t.alive? }.map(&:object_id) keys.each do |key| conn = @reserved_connections[key] checkin conn @reserved_connections.delete(key) end end |
#remove(conn) ⇒ Object
Note:
Method not part of the pre 4.0 API (does no exist).
20 21 22 23 24 25 |
# File 'lib/active_record/bogacs/pool_support.rb', line 20 def remove(conn) synchronize do @connections.delete conn release conn end end |