Module: FiberedMysql2::FiberedDatabaseConnectionPool
- Includes:
- FiberedMonitorMixin
- Defined in:
- lib/fibered_mysql2/fibered_database_connection_pool.rb
Defined Under Namespace
Modules: Adapter_4_2, Adapter_5_2
Instance Method Summary
collapse
extend_object, #mon_enter, #mon_exit, #mon_synchronize, #mon_try_enter, #new_cond
Instance Method Details
#connection ⇒ Object
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 184
def connection
if (result = cached_connections[current_connection_id])
result
else
synchronize do
if (result = cached_connections[current_connection_id])
result
else
cached_connections[current_connection_id] = checkout
end
end
end
end
|
#initialize(connection_spec, *args, **keyword_args) ⇒ Object
174
175
176
177
178
179
180
181
182
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 174
def initialize(connection_spec, *args, **keyword_args)
connection_spec.config[:reaping_frequency] and raise "reaping_frequency is not supported (the ActiveRecord Reaper is thread-based)"
super(connection_spec, *args, **keyword_args)
@reaper = nil
end
|
#reap_connections ⇒ Object
200
201
202
203
204
205
206
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 200
def reap_connections
cached_connections.values.each do |connection|
unless connection.owner.alive?
checkin(connection)
end
end
end
|