public class NonBlockingPool extends AbstractPool
NonBlockingPool pool provides the basic implementation of an object pool. The implementation uses a linked list to maintain a list of (available) objects. If the pool is empty it simply creates one using the ObjectFactory instance. Subclasses can change this behaviour by overriding getObject(...) and returnObject(....) methods. This class provides basic support for synchronization, event notification, pool shutdown and pool object recycling. It also does some very basic bookkeeping like the number of objects created, number of threads waiting for object.
Subclasses can make use of these book-keeping data to provide complex pooling mechanism like LRU / MRU / Random. Also, note that AbstractPool does not have a notion of pool limit. It is upto to the derived classes to implement these features.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
addedIdleBeanWork |
protected boolean |
addedResizeTask |
protected boolean |
inResizing |
_logger, appName, beanId, configData, containerClassLoader, createdCount, destroyedCount, ejbName, factory, idleTimeoutInSeconds, list, maxPoolSize, maxWaitTimeInMillis, modName, poolProbeNotifier, poolReturned, poolSuccess, resizeQuantity, steadyPoolSize, waitCount| Modifier | Constructor and Description |
|---|---|
protected |
NonBlockingPool() |
|
NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader) |
|
NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader,
boolean singletonBeanPool) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the pool
|
void |
destroyObject(Object object)
Destroys an Object.
|
protected void |
doResize() |
String |
getAllAttrValues() |
Object |
getObject(boolean canWait,
Object param)
Get an object.
|
Object |
getObject(long maxWaitTime,
Object param) |
Object |
getObject(Object param)
Get an object from the pool within the specified time.
|
protected void |
initializePool(ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader) |
protected void |
preload(int count)
Preload the pool with objects.
|
void |
prepopulate(int count)
Prepopulate the pool with objects.
|
protected void |
remove(int count) |
protected void |
removeIdleObjects() |
void |
returnObject(Object object)
Return an object back to the pool.
|
void |
setContainerClassLoader(ClassLoader loader) |
appendStats, getAllMonitoredAttrbuteValues, getCreatedCount, getDestroyedCount, getIdleTimeoutInSeconds, getJmsMaxMessagesLoad, getMaxPoolSize, getMaxWaitTimeInMillis, getNumBeansInPool, getNumThreadsWaiting, getPoolSuccess, getResizeQuantity, getSize, getSteadyPoolSize, getTotalBeansCreated, getTotalBeansDestroyed, getWaitCount, initializePool, setConfigData, setInfo, unregisterProbeProviderprotected boolean addedResizeTask
protected volatile boolean addedIdleBeanWork
protected boolean inResizing
protected NonBlockingPool()
public NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader)
public NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader,
boolean singletonBeanPool)
protected void initializePool(ObjectFactory factory, int steadyPoolSize, int resizeQuantity, int maxPoolSize, int idleTimeoutInSeconds, ClassLoader loader)
public void setContainerClassLoader(ClassLoader loader)
setContainerClassLoader in class AbstractPoolpublic Object getObject(boolean canWait, Object param) throws PoolException
getObject in interface PoolgetObject in class AbstractPoolcanWait - Must be true if the calling thread is willing to
wait for infinite time to get an object, false if the calling
thread does not want to wait at all.PoolExceptionpublic Object getObject(long maxWaitTime, Object param) throws PoolException
getObject in interface PoolgetObject in class AbstractPoolPoolExceptionpublic Object getObject(Object param)
PoolgetObject in interface PoolgetObject in class AbstractPoolpublic void returnObject(Object object)
returnObject in interface PoolreturnObject in class AbstractPoolpublic void destroyObject(Object object)
destroyObject in interface PooldestroyObject in class AbstractPoolprotected void preload(int count)
preload in class AbstractPoolcount - the number of objects to be added.public void prepopulate(int count)
count - the number of objects to be added.public void close()
close in class AbstractPoolprotected void remove(int count)
remove in class AbstractPoolprotected void removeIdleObjects()
removeIdleObjects in class AbstractPoolprotected void doResize()
public String getAllAttrValues()
getAllAttrValues in class AbstractPoolCopyright © 2015. All rights reserved.