Waits perpetually until an item is available in the pool and then returns it.
Waits perpetually until an item is available in the pool and then returns it.
T
Creates an item for use in the pool.
Creates an item for use in the pool. This method is invoked internally and should never be externally exposed.
Disposes the item and does not return it to the pool.
Disposes the item and does not return it to the pool. This lets the pool know that a new item can be created to
replace it. Calls disposeItem(t)
before the item count is reduced to allow any cleanup necessary to
occur.
the item to dispose.
Called immediately before an item is disposed from the pool.
Called immediately before an item is disposed from the pool. There is no requirement for this method to do anything, but allows for cleanup before this item is dumped from the pool.
the item being disposed.
the initial size, defaults to 0.
the initial size, defaults to 0.
the maximum size, defaults to Int.
the maximum size, defaults to Int.MaxValue.
Releases the item back to the pool for re-use.
Releases the item back to the pool for re-use. Calls releaseItem(t)
before it is returned to the
queue.
the item to return.
Called immediately before an item is placed back into the pool.
Called immediately before an item is placed back into the pool. There is no requirement for this method to do anything, but allows for cleanup before the item is recycled into the pool.
the item being released.
Requests an item from the pool for use.
Requests an item from the pool for use. Will block for waitTime
for the availability of the item.
the amount of time in seconds to wait for an available item from the pool. Defaults to Double.MaxValue.
if true an item will be added to the queue if there are no items available and the pool isn't fully utilized. Defaults to true.
Some[T] if the pool is not fully utilized
Use allows safe usage of an item with a guaranteed release back to the pool.
Use allows safe usage of an item with a guaranteed release back to the pool. The supplied function will receive an
an item when one becomes available (blocking) within waitTime
. If waitTime
elapses before
an item becomes available then the function will not be invoked an None
will be returned.
the return type of the function
the amount of time to wait for an item to become available in the pool. Defaults to Double.MaxValue
if true an item will be added to the queue if there are no items available and the pool isn't fully utilized. Defaults to true.
the function to invoke with the item.
Some[R] only if the function was able to successfully execute within the waitTime
.
SimplePool offers defaults for most of Pool values and only really needs an implementation of create.
the item type in the pool.