Class: ActiveRecord::ConnectionAdapters::ConnectionPool
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::ConnectionPool
- Defined in:
- lib/active_record/connection_adapters/mysqlplus_adapter/connection_pool.rb
Instance Attribute Summary collapse
-
#checked_out ⇒ Object
readonly
Returns the value of attribute checked_out.
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
-
#reserved_connections ⇒ Object
readonly
Returns the value of attribute reserved_connections.
Instance Method Summary collapse
-
#initialize(spec) ⇒ ConnectionPool
constructor
A new instance of ConnectionPool.
Constructor Details
#initialize(spec) ⇒ ConnectionPool
Returns a new instance of ConnectionPool.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_record/connection_adapters/mysqlplus_adapter/connection_pool.rb', line 9 def initialize(spec) @spec = spec # The cache of reserved connections mapped to threads @reserved_connections = {} # The mutex used to synchronize pool access @connection_mutex = Monitor.new @queue = @connection_mutex.new_cond # default 5 second timeout @timeout = spec.config[:wait_timeout] || 5 # default max pool size to 5 @size = (spec.config[:pool] && spec.config[:pool].to_i) || 5 @connections = [] @checked_out = [] # warmup hook warmup! if spec.config[:warmup] end |
Instance Attribute Details
#checked_out ⇒ Object (readonly)
Returns the value of attribute checked_out.
5 6 7 |
# File 'lib/active_record/connection_adapters/mysqlplus_adapter/connection_pool.rb', line 5 def checked_out @checked_out end |
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
5 6 7 |
# File 'lib/active_record/connection_adapters/mysqlplus_adapter/connection_pool.rb', line 5 def connections @connections end |
#reserved_connections ⇒ Object (readonly)
Returns the value of attribute reserved_connections.
5 6 7 |
# File 'lib/active_record/connection_adapters/mysqlplus_adapter/connection_pool.rb', line 5 def reserved_connections @reserved_connections end |