class Db2Query::Connection

Attributes

config[R]
connection_pool[R]
instrumenter[R]
lock[R]

Public Class Methods

new(config) click to toggle source
# File lib/db2_query/db_connection.rb, line 47
def initialize(config)
  @config = config
  @instrumenter = ActiveSupport::Notifications.instrumenter
  @lock = ActiveSupport::Concurrency::LoadInterlockAwareMonitor.new
  create_connection_pool
end

Public Instance Methods

create_connection_pool() click to toggle source
# File lib/db2_query/db_connection.rb, line 60
def create_connection_pool
  synchronize do
    return @connection_pool if @connection_pool
    @connection_pool = Pool.new(pool_config) { DbClient.new(config) }
  end
end
pool_config() click to toggle source
# File lib/db2_query/db_connection.rb, line 56
def pool_config
  { size: config[:pool], timeout: config[:timeout] }
end