Method: ActiveRecord::ConnectionAdapters::AbstractAdapter#lease
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
#lease ⇒ Object
this method must only be called while holding connection pool’s mutex
296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb', line 296 def lease if in_use? msg = +"Cannot lease connection, " if @owner == ActiveSupport::IsolatedExecutionState.context msg << "it is already leased by the current thread." else msg << "it is already in use by a different thread: #{@owner}. " \ "Current thread: #{ActiveSupport::IsolatedExecutionState.context}." end raise ActiveRecordError, msg end @owner = ActiveSupport::IsolatedExecutionState.context end |