public class LimitedPool<T>
extends java.lang.Object
A simple object pool which instantiates objects on-demand and keeps up to the given number of objects for later reuse.
Note: the class is not thread-safe; use synchronized version for concurrent access.
| Modifier and Type | Class and Description |
|---|---|
static interface |
LimitedPool.ObjectFactory<T> |
static class |
LimitedPool.Sync<T> |
| Constructor and Description |
|---|
LimitedPool(int maxCapacity,
LimitedPool.ObjectFactory<T> factory) |
| Modifier and Type | Method and Description |
|---|---|
T |
alloc() |
void |
recycle(T t) |
public LimitedPool(int maxCapacity,
LimitedPool.ObjectFactory<T> factory)