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
15 16 17 18 |
# File 'lib/active_record/bogacs/pool_support.rb', line 15 def current_connection_id # NOTE: possible fiber work-around on JRuby ?! Base.connection_id ||= Thread.current.object_id end |
#new_connection ⇒ Object
end
11 12 13 |
# File 'lib/active_record/bogacs/pool_support.rb', line 11 def new_connection Base.send(spec.adapter_method, spec.config) end |
#reap ⇒ Object
clear_stale_cached_connections! without the deprecation :
29 30 31 32 33 34 35 36 37 |
# File 'lib/active_record/bogacs/pool_support.rb', line 29 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).
21 22 23 24 25 26 |
# File 'lib/active_record/bogacs/pool_support.rb', line 21 def remove(conn) synchronize do @connections.delete conn release conn end end |