class Pool(T)
- Pool(T)
- Reference
- Object
Overview
Generic pool.
It will create N instances that can be checkin then checkout. Trying to checkout an instance from an empty pool will block until another coroutine checkin an instance back, up until a timeout is reached.
Direct Known Subclasses
Defined in:
pool.crConstructors
Instance Method Summary
-
#capacity : Int32
Returns how many instances can be started at maximum capacity.
-
#checkin(connection : T) : Nil
Checkin an instance back into the pool.
-
#checkout : T
Checkout an instance from the pool.
-
#pending : Int32
Returns how many instances are available for checkout.
-
#size : Int32
Returns how many instances have been started.
- #start_all
-
#timeout : Time::Span
Returns how much time to wait for an instance to be available before raising a Timeout exception.
Constructor Detail
Instance Method Detail
Checkout an instance from the pool. Blocks until an instance is available if
all instances are busy. Eventually raises an IO::Timeout
error.
Returns how much time to wait for an instance to be available before raising a Timeout exception.