Interface Pool<E>
- Type Parameters:
E- The type of object managed by this pool.
- All Known Implementing Classes:
LinkedPool, Unpool
public interface Pool<E>
The
Pool interface allows for pooling of objects.
Objects can be obtained from a pool and can later be resupplied to the pool to enable the pool to provide that object again in the future, which can reduce the overhead associated with object creation and garbage collection.
- Since:
- 1.8
-
Method Summary
-
Method Details
-
claim
Claims an instance ofPooledfrom the pool.When done with the object, it may be returned to the pool using either the
Pooled.free()method or thePooled.close()method. Do not call both, that would be a double-free.It is valid to not return ("steal") a claimed object to the pool. That prevents the pool from providing that object ever again.
- Returns:
- A
Pooledinstance containing an object of typeE.
-