@Deprecated
public abstract class SimplePool<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<T> |
_avail
Deprecated.
|
protected java.lang.String |
_name
Deprecated.
|
protected java.util.Set<T> |
_out
Deprecated.
|
protected int |
_size
Deprecated.
|
Constructor and Description |
---|
SimplePool(java.lang.String name,
int size)
Deprecated.
Initializes a new pool of objects.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup(T t)
Deprecated.
Override this if you need to do any cleanup
|
protected void |
close()
Deprecated.
Clears the pool of all objects.
|
protected abstract T |
createNew()
Deprecated.
Creates a new object of this pool's type.
|
void |
done(T t)
Deprecated.
Call done when you are done with an object form the pool.
|
T |
get()
Deprecated.
Gets an object from the pool - will block if none are available
|
T |
get(long waitTime)
Deprecated.
Gets an object from the pool - will block if none are available
|
int |
getAvailable()
Deprecated.
|
int |
getInUse()
Deprecated.
|
int |
getMaxSize()
Deprecated.
|
java.lang.String |
getName()
Deprecated.
|
int |
getTotal()
Deprecated.
|
protected int |
pick(int recommended,
boolean couldCreate)
Deprecated.
Pick a member of
_avail . |
void |
remove(T t)
Deprecated.
|
java.lang.String |
toString()
Deprecated.
|
protected final java.lang.String _name
protected final int _size
protected final java.util.List<T> _avail
protected final java.util.Set<T> _out
public SimplePool(java.lang.String name, int size)
name
- name for the poolsize
- max to hold to at any given time. if < 0 then no limitprotected abstract T createNew()
public void cleanup(T t)
t
- the object that was addedprotected int pick(int recommended, boolean couldCreate)
_avail
. This method is called with a lock held on _avail
, so it may be used safely.recommended
- the recommended member to choose.couldCreate
- true if there is room in the pool to create a new objectpublic void done(T t)
t
- Object to addpublic void remove(T t)
public T get() throws java.lang.InterruptedException
java.lang.InterruptedException
public T get(long waitTime) throws java.lang.InterruptedException
waitTime
- negative - forever 0 - return immediately no matter what positive ms to waitjava.lang.InterruptedException
protected void close()
public java.lang.String getName()
public int getTotal()
public int getInUse()
public int getAvailable()
public int getMaxSize()
public java.lang.String toString()
toString
in class java.lang.Object