Class: ActiveRecord::ConnectionAdapters::ConnectionPool::ConnectionLeasingQueue
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Queue
|
|
Instance Chain:
self,
BiasableQueue ,
Queue
|
|
Inherits: |
ActiveRecord::ConnectionAdapters::ConnectionPool::Queue
|
Defined in: | activerecord/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb |
Overview
Connections must be leased while holding the main pool mutex. This is an internal subclass that also .leases
returned connections while still in queue’s critical section (queue synchronizes with the same @lock
as the main pool) so that a returned connection is already leased and there is no need to re-enter synchronized block.
Class Method Summary
Instance Attribute Summary
Queue
- Inherited
#any_waiting? | Test if any threads are currently waiting on the queue. |
#any? | Test if the queue currently contains any elements. |
#can_remove_no_wait? | A thread can remove an element from the queue without waiting if and only if the number of currently available connections is strictly greater than the number of waiting threads. |
Instance Method Summary
- #internal_poll(timeout) private
BiasableQueue
- Included
Queue
- Inherited
#add | Add |
#clear | Remove all elements from the queue. |
#delete | If |
#num_waiting | Returns the number of threads currently waiting on this queue. |
#poll | Remove the head of the queue. |
#internal_poll, | |
#no_wait_poll | Remove and return the head of the queue if the number of available elements is strictly greater than the number of threads currently waiting. |
#remove | Removes and returns the head of the queue if possible, or |
#synchronize, | |
#wait_poll | Waits on the queue up to |
Constructor Details
This class inherits a constructor from ActiveRecord::ConnectionAdapters::ConnectionPool::Queue
Instance Method Details
#internal_poll(timeout) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb', line 202
def internal_poll(timeout) conn = super conn.lease if conn conn end