T - the type of the elementsE - the type of exception thrown by create()public abstract class ElasticPool<T,E extends Exception> extends Object
| Constructor and Description |
|---|
ElasticPool(int sizeLimit) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
create()
A method to create a new element.
|
protected void |
destroy(T element)
A method to destroy an element.
|
void |
discard(T element)
Discard an element from the pool.
|
T |
obtain()
Get a element from the pool.
|
protected void |
recycle(T element)
A method to recycle an existing element when it is returned to the pool.
|
void |
release(T element)
Returns an element to the pool of available elements.
|
protected abstract T create() throws E extends Exception
protected void destroy(T element)
element - the element to destroyprotected void recycle(T element)
element - the element to recyclepublic T obtain() throws E extends Exception
public void release(T element)
element - the element to be returnedpublic void discard(T element)
element - Copyright © 2015. All Rights Reserved.