|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.ejb.containers.util.pool.AbstractPool
com.sun.ejb.containers.util.pool.NonBlockingPool
public class NonBlockingPool
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.
| Field Summary | |
|---|---|
protected boolean |
addedIdleBeanWork
|
protected boolean |
addedResizeTask
|
protected boolean |
inResizing
|
| Fields inherited from class com.sun.ejb.containers.util.pool.AbstractPool |
|---|
_logger, appName, beanId, configData, containerClassLoader, createdCount, destroyedCount, ejbName, factory, idleTimeoutInSeconds, list, maxPoolSize, maxWaitTimeInMillis, modName, poolProbeNotifier, poolReturned, poolSuccess, resizeQuantity, steadyPoolSize, waitCount |
| Constructor Summary | |
|---|---|
protected |
NonBlockingPool()
|
|
NonBlockingPool(long beanId,
java.lang.String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
|
|
NonBlockingPool(long beanId,
java.lang.String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader,
boolean singletonBeanPool)
|
| Method Summary | |
|---|---|
void |
close()
Close the pool |
void |
destroyObject(java.lang.Object object)
Destroys an Object. |
protected void |
doResize()
|
java.lang.String |
getAllAttrValues()
|
java.lang.Object |
getObject(boolean canWait,
java.lang.Object param)
Get an object. |
java.lang.Object |
getObject(long maxWaitTime,
java.lang.Object param)
|
java.lang.Object |
getObject(java.lang.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,
java.lang.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(java.lang.Object object)
Return an object back to the pool. |
void |
setContainerClassLoader(java.lang.ClassLoader loader)
|
| Methods inherited from class com.sun.ejb.containers.util.pool.AbstractPool |
|---|
appendStats, getAllMonitoredAttrbuteValues, getCreatedCount, getDestroyedCount, getIdleTimeoutInSeconds, getJmsMaxMessagesLoad, getMaxPoolSize, getMaxWaitTimeInMillis, getNumBeansInPool, getNumThreadsWaiting, getPoolSuccess, getResizeQuantity, getSize, getSteadyPoolSize, getTotalBeansCreated, getTotalBeansDestroyed, getWaitCount, initializePool, setConfigData, setInfo, unregisterProbeProvider |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean addedResizeTask
protected volatile boolean addedIdleBeanWork
protected boolean inResizing
| Constructor Detail |
|---|
protected NonBlockingPool()
public NonBlockingPool(long beanId,
java.lang.String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
public NonBlockingPool(long beanId,
java.lang.String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader,
boolean singletonBeanPool)
| Method Detail |
|---|
protected void initializePool(ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
public void setContainerClassLoader(java.lang.ClassLoader loader)
setContainerClassLoader in class AbstractPool
public java.lang.Object getObject(boolean canWait,
java.lang.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.
PoolException
public java.lang.Object getObject(long maxWaitTime,
java.lang.Object param)
throws PoolException
getObject in interface PoolgetObject in class AbstractPoolPoolExceptionpublic java.lang.Object getObject(java.lang.Object param)
Pool
getObject in interface PoolgetObject in class AbstractPoolpublic void returnObject(java.lang.Object object)
returnObject in interface PoolreturnObject in class AbstractPoolpublic void destroyObject(java.lang.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 java.lang.String getAllAttrValues()
getAllAttrValues in class AbstractPool
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||