ObjectPool
A bounded pool that reuses instances instead of creating new ones.
borrow returns a pooled instance when one is available and otherwise creates a fresh one with factory. recycle resets an instance with the reset callback and stores it, unless the pool already holds capacity instances, in which case the instance is dropped without reset. The pool never verifies that a recycled instance came from borrow.
This class is not thread-safe.
Type Parameters
T
the pooled instance type.
Throws
if capacity is negative.