T - the type of the object to poolpublic abstract class ObjectPool<T>
extends java.lang.Object
ConcurrentLinkedQueue for
synchronization.| Constructor | Description |
|---|---|
ObjectPool() |
| Modifier and Type | Method | Description |
|---|---|---|
T |
allocate() |
Allocate an object from the pool or create a new one if we cannot get one
from the queue.
|
protected abstract T |
newInstance() |
Subclasses must override the object creation method.
|
void |
replace(T value) |
Return an object to the pool.
|
public final T allocate()
public final void replace(T value)
value - the object being returnedprotected abstract T newInstance()
Copyright © 2017 Oracle Corporation. All rights reserved.