aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
diff options
context:
space:
mode:
authorJerry D'Antonio <stumpjumper@gmail.com>2015-09-19 09:56:26 -0400
committerJerry D'Antonio <stumpjumper@gmail.com>2015-09-19 09:56:26 -0400
commit56ac6e4768adb1f7055474d40a9e921380559c43 (patch)
tree01e085d38060f8739944177d6001c6996b6fc779 /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
parent0c39a022b0b432afff240c5624dadee00da8d175 (diff)
downloadrails-56ac6e4768adb1f7055474d40a9e921380559c43.tar.gz
rails-56ac6e4768adb1f7055474d40a9e921380559c43.tar.bz2
rails-56ac6e4768adb1f7055474d40a9e921380559c43.zip
Replaced `ThreadSafe::Map` with successor `Concurrent::Map`.
The thread_safe gem is being deprecated and all its code has been merged into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly the same as its predecessor except for fixes to two bugs discovered during the merge.
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.rb12
1 files changed, 6 insertions, 6 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 6544b64f52..b579bc1e93 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -1,5 +1,5 @@
require 'thread'
-require 'thread_safe'
+require 'concurrent'
require 'monitor'
module ActiveRecord
@@ -337,7 +337,7 @@ module ActiveRecord
# that case +conn.owner+ attr should be consulted.
# Access and modification of +@thread_cached_conns+ does not require
# synchronization.
- @thread_cached_conns = ThreadSafe::Cache.new(:initial_capacity => @size)
+ @thread_cached_conns = Concurrent::Map.new(:initial_capacity => @size)
@connections = []
@automatic_reconnect = true
@@ -824,11 +824,11 @@ module ActiveRecord
# These caches are keyed by klass.name, NOT klass. Keying them by klass
# alone would lead to memory leaks in development mode as all previous
# instances of the class would stay in memory.
- @owner_to_pool = ThreadSafe::Cache.new(:initial_capacity => 2) do |h,k|
- h[k] = ThreadSafe::Cache.new(:initial_capacity => 2)
+ @owner_to_pool = Concurrent::Map.new(:initial_capacity => 2) do |h,k|
+ h[k] = Concurrent::Map.new(:initial_capacity => 2)
end
- @class_to_pool = ThreadSafe::Cache.new(:initial_capacity => 2) do |h,k|
- h[k] = ThreadSafe::Cache.new
+ @class_to_pool = Concurrent::Map.new(:initial_capacity => 2) do |h,k|
+ h[k] = Concurrent::Map.new
end
end