module ActiveRecord::ConnectionAdapters

Public Instance Methods

discard!() click to toggle source
# File lib/active_record/connection_adapters/adapter_compat.rb, line 128
def discard!
  # no-op
end
expire() click to toggle source

this method must only be called while holding connection pool’s mutex @private AR 5.2

# File lib/active_record/connection_adapters/adapter_compat.rb, line 36
def expire
  if in_use?
    if @owner != Thread.current
      raise ActiveRecordError, "Cannot expire connection, " \
        "it is owned by a different thread: #{@owner}. " \
        "Current thread: #{Thread.current}."
    end

    @idle_since = ::Concurrent.monotonic_time
    @owner = nil
  else
    raise ActiveRecordError, "Cannot expire connection, it is not currently leased."
  end
end
lease() click to toggle source

this method must only be called while holding connection pool’s mutex

# File lib/active_record/connection_adapters/adapter_compat.rb, line 19
def lease
  if in_use?
    msg = "Cannot lease connection, ".dup
    if @owner == Thread.current
      msg << "it is already leased by the current thread."
    else
      msg << "it is already in use by a different thread: #{@owner}. " \
             "Current thread: #{Thread.current}."
    end
    raise ActiveRecordError, msg
  end

  @owner = Thread.current
end