From 56ac6e4768adb1f7055474d40a9e921380559c43 Mon Sep 17 00:00:00 2001
From: Jerry D'Antonio <stumpjumper@gmail.com>
Date: Sat, 19 Sep 2015 09:56:26 -0400
Subject: 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.
---
 activerecord/lib/active_record/attribute_methods.rb          |  4 ++--
 .../connection_adapters/abstract/connection_pool.rb          | 12 ++++++------
 activerecord/lib/active_record/type/type_map.rb              |  6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)

(limited to 'activerecord/lib')

diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 0862306749..82b07de482 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -1,7 +1,7 @@
 require 'active_support/core_ext/enumerable'
 require 'active_support/core_ext/string/filters'
 require 'mutex_m'
-require 'thread_safe'
+require 'concurrent'
 
 module ActiveRecord
   # = Active Record Attribute Methods
@@ -37,7 +37,7 @@ module ActiveRecord
     class AttributeMethodCache
       def initialize
         @module = Module.new
-        @method_cache = ThreadSafe::Cache.new
+        @method_cache = Concurrent::Map.new
       end
 
       def [](name)
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
 
diff --git a/activerecord/lib/active_record/type/type_map.rb b/activerecord/lib/active_record/type/type_map.rb
index 09f5ba6b74..8ce36cc9af 100644
--- a/activerecord/lib/active_record/type/type_map.rb
+++ b/activerecord/lib/active_record/type/type_map.rb
@@ -1,12 +1,12 @@
-require 'thread_safe'
+require 'concurrent'
 
 module ActiveRecord
   module Type
     class TypeMap # :nodoc:
       def initialize
         @mapping = {}
-        @cache = ThreadSafe::Cache.new do |h, key|
-          h.fetch_or_store(key, ThreadSafe::Cache.new)
+        @cache = Concurrent::Map.new do |h, key|
+          h.fetch_or_store(key, Concurrent::Map.new)
         end
       end
 
-- 
cgit v1.2.3