T
- public abstract class Pool<T>
extends java.lang.Object
Constructor and Description |
---|
Pool()
Default constructor.
|
Pool(int initialSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkin(T object)
Checks in an object into the pool.
|
T |
checkout()
Checks out an object from the pool.
|
void |
clear()
Clears the store of reusable objects.
|
protected void |
clear(T object)
Clears the given object when it is checked in the pool.
|
protected abstract T |
createObject()
Creates a new reusable object.
|
protected java.util.Queue<T> |
createStore()
Creates the store of reusable objects.
|
protected java.util.Queue<T> |
getStore()
Returns the store containing the reusable objects.
|
void |
preCreate(int initialSize)
Pre-creates the initial objects using the
createObject() method
and check them in the pool using the checkin(Object) method. |
public Pool()
public Pool(int initialSize)
preCreate(int)
method.initialSize
- The initial number of objects in the pool.public void checkin(T object)
object
- The object to check in.public T checkout()
public void clear()
protected void clear(T object)
object
- The object to clear.protected abstract T createObject()
protected java.util.Queue<T> createStore()
protected java.util.Queue<T> getStore()
public void preCreate(int initialSize)
createObject()
method
and check them in the pool using the checkin(Object)
method.initialSize
- The initial number of objects.Copyright © 2005-2020 Restlet.