Method: ActiveRecord::ConnectionAdapters::AbstractAdapter#steal!

Defined in:
lib/active_record/connection_adapters/abstract_adapter.rb

#steal!Object

this method must only be called while holding connection pool’s mutex (and a desire for segfaults)



349
350
351
352
353
354
355
356
357
358
359
# File 'lib/active_record/connection_adapters/abstract_adapter.rb', line 349

def steal! # :nodoc:
  if in_use?
    if @owner != ActiveSupport::IsolatedExecutionState.context
      pool.send :remove_connection_from_thread_cache, self, @owner

      @owner = ActiveSupport::IsolatedExecutionState.context
    end
  else
    raise ActiveRecordError, "Cannot steal connection, it is not currently leased."
  end
end