Class: ActiveRecord::ConnectionAdapters::PoolConfig
- Includes:
- Mutex_m
- Defined in:
- activerecord/lib/active_record/connection_adapters/pool_config.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#connection_specification_name ⇒ Object
readonly
Returns the value of attribute connection_specification_name.
-
#db_config ⇒ Object
readonly
Returns the value of attribute db_config.
-
#schema_cache ⇒ Object
Returns the value of attribute schema_cache.
Class Method Summary collapse
Instance Method Summary collapse
- #discard_pool! ⇒ Object
- #disconnect! ⇒ Object
-
#initialize(connection_specification_name, db_config) ⇒ PoolConfig
constructor
A new instance of PoolConfig.
- #pool ⇒ Object
Constructor Details
#initialize(connection_specification_name, db_config) ⇒ PoolConfig
Returns a new instance of PoolConfig.
20 21 22 23 24 25 26 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 20 def initialize(connection_specification_name, db_config) super() @connection_specification_name = connection_specification_name @db_config = db_config @pool = nil INSTANCES[self] = self end |
Instance Attribute Details
#connection_specification_name ⇒ Object (readonly)
Returns the value of attribute connection_specification_name
8 9 10 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 8 def connection_specification_name @connection_specification_name end |
#db_config ⇒ Object (readonly)
Returns the value of attribute db_config
8 9 10 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 8 def db_config @db_config end |
#schema_cache ⇒ Object
Returns the value of attribute schema_cache
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 9 def schema_cache @schema_cache end |
Class Method Details
.discard_pools! ⇒ Object
15 16 17 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 15 def discard_pools! INSTANCES.each_key(&:discard_pool!) end |
Instance Method Details
#discard_pool! ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 49 def discard_pool! return unless @pool synchronize do return unless @pool @pool.discard! @pool = nil end end |
#disconnect! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 28 def disconnect! ActiveSupport::ForkTracker.check! return unless @pool synchronize do return unless @pool @pool.automatic_reconnect = false @pool.disconnect! end nil end |
#pool ⇒ Object
43 44 45 46 47 |
# File 'activerecord/lib/active_record/connection_adapters/pool_config.rb', line 43 def pool ActiveSupport::ForkTracker.check! @pool || synchronize { @pool ||= ConnectionAdapters::ConnectionPool.new(self) } end |