From cab76ce6ac2983f59451e2d53b23746a2873aea0 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 19 Apr 2008 14:42:56 -0500 Subject: Add synchronization to connection pool also --- .../connection_adapters/abstract/connection_specification.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index e262b2bac5..ed9d074506 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -27,6 +27,8 @@ module ActiveRecord @@connection_pools = {} class << self + # Turning on allow_concurrency basically switches a null mutex for a real one, so that + # multi-threaded access of the connection pools hash is synchronized. def allow_concurrency=(flag) if @@allow_concurrency != flag if flag @@ -37,7 +39,7 @@ module ActiveRecord end end - # for internal use only + # for internal use only and for testing def active_connections #:nodoc: @@connection_pools.inject({}) do |hash,kv| hash[kv.first] = kv.last.active_connection -- cgit v1.2.3