diff options
author | Nick Sieger <nick@nicksieger.com> | 2008-08-22 12:19:29 -0500 |
---|---|---|
committer | Nick Sieger <nick@nicksieger.com> | 2008-08-29 14:12:12 -0500 |
commit | ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943 (patch) | |
tree | d0527720f9d7ceaa46fd6a8844fecd46aaa0ae18 /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
parent | a96b7d4c33757364a19ed1fc34f0a89801b8b2d7 (diff) | |
download | rails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.tar.gz rails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.tar.bz2 rails-ca6d71753f3a2e8a0a29108b7c55ba3b7c8cd943.zip |
Deprecate allow_concurrency and make it have no effect
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 | 25 |
1 files changed, 5 insertions, 20 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 365c80fe1d..04c8361c64 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -154,7 +154,7 @@ module ActiveRecord private def new_connection - config = spec.config.reverse_merge(:allow_concurrency => ActiveRecord::Base.allow_concurrency) + config = spec.config.reverse_merge(:allow_concurrency => true) ActiveRecord::Base.send(spec.adapter_method, config) end @@ -285,9 +285,12 @@ module ActiveRecord end end - module ConnectionHandlerMethods + class ConnectionHandler + attr_reader :connection_pools_lock + def initialize(pools = {}) @connection_pools = pools + @connection_pools_lock = Monitor.new end def connection_pools @@ -361,24 +364,6 @@ module ActiveRecord klass = klass.superclass end end - end - - # This connection handler is not thread-safe, as it does not protect access - # to the underlying connection pools. - class SingleThreadConnectionHandler - include ConnectionHandlerMethods - end - - # This connection handler is thread-safe. Each access or modification of a thread - # pool is synchronized by an internal monitor. - class MultipleThreadConnectionHandler - attr_reader :connection_pools_lock - include ConnectionHandlerMethods - - def initialize(pools = {}) - super - @connection_pools_lock = Monitor.new - end # Apply monitor to all public methods that access the pool. synchronize :establish_connection, :retrieve_connection, |