public class ObjectPool<T> extends Object
| Constructor and Description |
|---|
ObjectPool(Class<T> cls) |
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanCurrentThread() |
T |
get()
Returns instance from pool, or create one if pool is empty.
|
static <T> ObjectPool<T> |
get(Class<T> cls)
Returns per-thread object pool for given type, or create one if it doesn't exist.
|
void |
release(T obj)
Release instance into pool.
|
public T get()
public void release(T obj)
obj - previously obtained instance from poolpublic static <T> ObjectPool<T> get(Class<T> cls)
cls - typepublic static void cleanCurrentThread()