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_check_owner, #mon_enter, #mon_exit, #mon_initialize, #mon_synchronize, #mon_try_enter, #new_cond
Instance Method Details
#connection ⇒ Object
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 251
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
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 240
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)"
connection_spec.config[:reaping_frequency] = nil
super(connection_spec, *args, **keyword_args)
@reaper = nil
end
|
#reap_connections ⇒ Object
267
268
269
270
271
272
273
|
# File 'lib/fibered_mysql2/fibered_database_connection_pool.rb', line 267
def reap_connections
cached_connections.values.each do |connection|
unless connection.owner.alive?
checkin(connection)
end
end
end
|