A simple object pool that creates the objects as needed until a maximum number of objects has been created.
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Type members
Inherited and Abstract classlikes
Attributes
- Inherited from:
- ArrayBlockingQueuePool
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Inherited methods
Acquire a lease for an object blocking if none is available.
Acquire a lease for an object blocking if none is available.
Attributes
- Returns
-
a lease for an object from this pool.
- Throws
-
ClosedPoolException
If this pool is closed.
- Inherited from:
- Pool
Closes this pool, and properly disposes of each pooled object, releasing any resources associated with the pool (e.g. background timer threads).
Closes this pool, and properly disposes of each pooled object, releasing any resources associated with the pool (e.g. background timer threads).
If the pool has already been closed this method does nothing.
Attributes
- Inherited from:
- Pool
Drains the object pool, i.e. evicts every object currently pooled.
Drains the object pool, i.e. evicts every object currently pooled.
Attributes
- Throws
-
ClosedPoolException
If this pool is closed.
- Inherited from:
- Pool
Fills the object pool by creating (and pooling) new objects until the number of live objects reaches the pool capacity.
Fills the object pool by creating (and pooling) new objects until the number of live objects reaches the pool capacity.
Attributes
- Throws
-
ClosedPoolException
If this pool is closed.
- Inherited from:
- Pool
Returns the number of leased objects.
Returns the number of leased objects.
The value returned by this method is only accurate when the referenceType
is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.
Attributes
- Returns
-
the number of leased objects.
- Inherited from:
- Pool
Returns the number of live objects, i.e. the number of currently pooled objects plus leased objects.
Returns the number of live objects, i.e. the number of currently pooled objects plus leased objects.
The value returned by this method is only accurate when the referenceType
is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.
Attributes
- Returns
-
the number of live objects.
- Inherited from:
- ArrayBlockingQueuePool
Returns the number of objects in the pool.
Returns the number of objects in the pool.
The value returned by this method is only accurate when the referenceType
is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.
Attributes
- Returns
-
the number of objects in the pool.
- Inherited from:
- ArrayBlockingQueuePool
Try to acquire a lease for an object blocking at most until the given duration.
Try to acquire a lease for an object blocking at most until the given duration.
Value parameters
- atMost
-
maximum wait time for the lease to be available.
Attributes
- Returns
-
a lease for an object from this pool if available until the given duration,
None
otherwise. - Throws
-
ClosedPoolException
If this pool is closed.
- Inherited from:
- Pool
Try to acquire a lease for an object without blocking.
Try to acquire a lease for an object without blocking.
Attributes
- Returns
-
a lease for an object from this pool if available,
None
otherwise. - Throws
-
ClosedPoolException
If this pool is closed.
- Inherited from:
- Pool
Inherited fields
Attributes
- Inherited from:
- ArrayBlockingQueuePool