diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-28 16:43:34 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-28 16:43:34 -0700 |
commit | 4211866b7a1d0abf0c9150fd61ea67a8043b831d (patch) | |
tree | 8de03d27c551c085f35b6297f51e97917fadf83b /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
parent | ec0cacc2938cb7159ae6085fc653b2be906a748f (diff) | |
download | rails-4211866b7a1d0abf0c9150fd61ea67a8043b831d.tar.gz rails-4211866b7a1d0abf0c9150fd61ea67a8043b831d.tar.bz2 rails-4211866b7a1d0abf0c9150fd61ea67a8043b831d.zip |
adding active_connection? to the connection pool
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 4297c26413..61e44d09bf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -151,6 +151,12 @@ module ActiveRecord @reserved_connections[current_connection_id] ||= checkout end + # Check to see if there is an active connection in this connection + # pool. + def active_connection? + @reserved_connections.key? current_connection_id + end + # Signal that the thread is finished with the current connection. # #release_connection releases the connection-thread association # and returns the connection to the pool. |