Sha256: 23a210b7844e1bdf1fe50a15bf8f8d005c7b5e5aa22a7cd0bfe50909660de83c
Contents?: true
Size: 1.06 KB
Versions: 33
Compression:
Stored size: 1.06 KB
Contents
module ActiveRecord module ConnectionAdapters module JdbcConnectionPoolCallbacks def self.included(base) if base.respond_to?(:set_callback) # Rails 3 callbacks base.set_callback :checkin, :after, :on_checkin base.set_callback :checkout, :before, :on_checkout else base.checkin :on_checkin base.checkout :on_checkout end end def self.needed? ActiveRecord::Base.respond_to?(:connection_pool) end def on_checkin # default implementation does nothing end def on_checkout # default implementation does nothing end end module JndiConnectionPoolCallbacks def self.prepare(adapter, conn) if ActiveRecord::Base.respond_to?(:connection_pool) && conn.jndi_connection? adapter.extend self conn.disconnect! # disconnect initial connection in JdbcConnection#initialize end end def on_checkin disconnect! end def on_checkout reconnect! end end end end
Version data entries
33 entries across 33 versions & 8 rubygems