public class UniqueObjectPool
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected PoolableObjectFactory |
factory
the object pool factory
|
Constructor and Description |
---|
UniqueObjectPool(PoolableObjectFactory factory)
separate pool per key.
|
Modifier and Type | Method and Description |
---|---|
int |
borrowedObjectsCount()
The number of objects that are currently checked out.
|
java.lang.Object |
borrowObject(java.lang.Object key)
borrow an object
|
void |
close()
Close this pool and free up resource.
|
static java.lang.Object |
currentKey()
What is the current key that we are creating an object for.
|
void |
invalidateObject(java.lang.Object borrowedObject)
Invalidate this object
|
protected ObjectPool |
makePool()
make a new pool
|
static java.lang.Object |
requestKey()
What is the borrow key that request an object for.
|
void |
returnObject(java.lang.Object borrowedObject)
return an object back into the pool.
|
int |
size()
pool size
|
public UniqueObjectPool(PoolableObjectFactory factory)
factory
- The factory to create the pools withpublic static java.lang.Object currentKey()
public static java.lang.Object requestKey()
public int size()
public java.lang.Object borrowObject(java.lang.Object key) throws java.lang.Exception
key
- the key to borrow.java.lang.Exception
- a serious problempublic void returnObject(java.lang.Object borrowedObject) throws java.lang.Exception
borrowedObject
- the object to be returnedjava.lang.Exception
- a serious problempublic void invalidateObject(java.lang.Object borrowedObject) throws java.lang.Exception
borrowedObject
- the object that will be invalidated.java.lang.Exception
- a serious problemprotected ObjectPool makePool() throws java.lang.Exception
java.lang.Exception
- a serious problempublic int borrowedObjectsCount()
public void close()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.