Interface Pool<T>
- Type Parameters:
- T- pool element type.
- All Known Implementing Classes:
- SimplePool
public interface Pool<T>
Represents a pool of items.
- Since:
- 2.2
- Author:
- Gary Russell
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidclose()Close the pool; returned items will be destroyed.intReturn the number of allocated items that are currently checked out of the pool.intReturn the current count of allocated items (in use and idle).intReturn the number of items that have been allocated but are not currently in use.getItem()Obtain an item from the pool.intReturn the current size (limit) of the pool.voidreleaseItem(T t) Release an item back into the pool.voidRemove all idle items from the pool.
- 
Method Details- 
getItemT getItem()Obtain an item from the pool.- Returns:
- the item.
 
- 
releaseItemRelease an item back into the pool. This must be an item that was previously retrieved usinggetItem().- Parameters:
- t- the item.
- Throws:
- IllegalArgumentException- when a "foreign" object is released.
 
- 
removeAllIdleItemsvoid removeAllIdleItems()Remove all idle items from the pool.
- 
getPoolSizeint getPoolSize()Return the current size (limit) of the pool.- Returns:
- the size.
 
- 
getIdleCountint getIdleCount()Return the number of items that have been allocated but are not currently in use.- Returns:
- The number of items.
 
- 
getActiveCountint getActiveCount()Return the number of allocated items that are currently checked out of the pool.- Returns:
- The number of items.
 
- 
getAllocatedCountint getAllocatedCount()Return the current count of allocated items (in use and idle). May be less than the pool size, and reflects the high watermark of pool usage.- Returns:
- the number of items.
 
- 
closedefault void close()Close the pool; returned items will be destroyed.- Since:
- 4.3.23
 
 
-