public interface Pool<T>
Modifier and Type | Method and Description |
---|---|
default void |
close()
Close the pool; returned items will be destroyed.
|
int |
getActiveCount()
Returns the number of allocated items that are currently
checked out of the pool.
|
int |
getAllocatedCount()
Returns the current count of allocated items (in use and
idle).
|
int |
getIdleCount()
Returns the number of items that have been allocated
but are not currently in use.
|
T |
getItem()
Obtains an item from the pool.
|
int |
getPoolSize()
Returns the current size (limit) of the pool.
|
void |
releaseItem(T t)
Releases an item back into the pool.
|
void |
removeAllIdleItems()
Removes all idle items from the pool.
|
T getItem()
void releaseItem(T t)
getItem()
.t
- the item.IllegalArgumentException
- when a "foreign" object
is released.void removeAllIdleItems()
int getPoolSize()
int getIdleCount()
int getActiveCount()
int getAllocatedCount()
default void close()