|
||||||||||
| 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
public abstract class AbstractPool
Abstract 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 static java.util.logging.Logger |
_logger
|
protected java.lang.String |
appName
|
protected long |
beanId
|
protected java.lang.String |
configData
|
protected java.lang.ClassLoader |
containerClassLoader
|
protected int |
createdCount
|
protected int |
destroyedCount
|
protected java.lang.String |
ejbName
|
protected ObjectFactory |
factory
|
protected int |
idleTimeoutInSeconds
|
protected java.util.ArrayList |
list
|
protected int |
maxPoolSize
|
protected long |
maxWaitTimeInMillis
|
protected java.lang.String |
modName
|
protected java.lang.String |
poolName
|
protected EjbPoolProbeProvider |
poolProbeNotifier
|
protected int |
poolReturned
|
protected int |
poolSuccess
|
protected int |
resizeQuantity
|
protected int |
steadyPoolSize
|
protected int |
waitCount
|
| Constructor Summary | |
|---|---|
protected |
AbstractPool()
|
protected |
AbstractPool(ObjectFactory factory,
long beanId,
int steadyPoolSize,
int resizeQuantity,
int maxPoolsize,
long maxWaitTimeInMillis,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
|
| Method Summary | |
|---|---|
void |
appendStats(java.lang.StringBuffer sbuf)
|
void |
close()
Close the pool |
void |
destroyObject(java.lang.Object object)
Destroys an Object. |
java.lang.String |
getAllAttrValues()
|
java.lang.String |
getAllMonitoredAttrbuteValues()
|
int |
getCreatedCount()
|
int |
getDestroyedCount()
|
int |
getIdleTimeoutInSeconds()
|
int |
getJmsMaxMessagesLoad()
|
int |
getMaxPoolSize()
|
long |
getMaxWaitTimeInMillis()
|
int |
getNumBeansInPool()
|
int |
getNumThreadsWaiting()
|
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. |
int |
getPoolSuccess()
|
int |
getResizeQuantity()
|
int |
getSize()
|
int |
getSteadyPoolSize()
|
int |
getTotalBeansCreated()
|
int |
getTotalBeansDestroyed()
|
int |
getWaitCount()
|
protected void |
initializePool(ObjectFactory factory,
long beanId,
int steadyPoolSize,
int resizeQuantity,
int maxPoolsize,
long maxWaitTimeInMillis,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
|
protected void |
preload(int count)
Preload the pool with objects. |
protected void |
remove(int count)
|
protected abstract void |
removeIdleObjects()
|
void |
returnObject(java.lang.Object object)
Return an object back to the pool. |
void |
setConfigData(java.lang.String configData)
|
void |
setContainerClassLoader(java.lang.ClassLoader loader)
|
void |
setInfo(java.lang.String appName,
java.lang.String modName,
java.lang.String ejbName)
|
protected void |
unregisterProbeProvider()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.logging.Logger _logger
protected java.util.ArrayList list
protected ObjectFactory factory
protected int waitCount
protected int createdCount
protected int steadyPoolSize
protected int resizeQuantity
protected int maxPoolSize
protected long maxWaitTimeInMillis
protected int idleTimeoutInSeconds
protected java.lang.ClassLoader containerClassLoader
protected int destroyedCount
protected int poolSuccess
protected java.lang.String poolName
protected int poolReturned
protected java.lang.String configData
protected EjbPoolProbeProvider poolProbeNotifier
protected java.lang.String appName
protected java.lang.String modName
protected java.lang.String ejbName
protected long beanId
| Constructor Detail |
|---|
protected AbstractPool()
protected AbstractPool(ObjectFactory factory,
long beanId,
int steadyPoolSize,
int resizeQuantity,
int maxPoolsize,
long maxWaitTimeInMillis,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
| Method Detail |
|---|
protected void initializePool(ObjectFactory factory,
long beanId,
int steadyPoolSize,
int resizeQuantity,
int maxPoolsize,
long maxWaitTimeInMillis,
int idleTimeoutInSeconds,
java.lang.ClassLoader loader)
public void setContainerClassLoader(java.lang.ClassLoader loader)
public void setInfo(java.lang.String appName,
java.lang.String modName,
java.lang.String ejbName)
public java.lang.Object getObject(boolean canWait,
java.lang.Object param)
throws PoolException
getObject in interface PoolcanWait - 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 PoolPoolException
public java.lang.Object getObject(java.lang.Object param)
throws PoolException
Pool
getObject in interface PoolPoolExceptionpublic void returnObject(java.lang.Object object)
returnObject in interface Poolpublic void destroyObject(java.lang.Object object)
destroyObject in interface Poolprotected void preload(int count)
count - the number of objects to be added.public void close()
protected void remove(int count)
protected abstract void removeIdleObjects()
public int getCreatedCount()
public int getDestroyedCount()
public int getPoolSuccess()
public int getSize()
public int getWaitCount()
public int getSteadyPoolSize()
getSteadyPoolSize in interface EJBPoolStatsProviderpublic int getResizeQuantity()
public int getMaxPoolSize()
getMaxPoolSize in interface EJBPoolStatsProviderpublic long getMaxWaitTimeInMillis()
public int getIdleTimeoutInSeconds()
public void setConfigData(java.lang.String configData)
public void appendStats(java.lang.StringBuffer sbuf)
appendStats in interface StatsProviderpublic int getJmsMaxMessagesLoad()
getJmsMaxMessagesLoad in interface EJBPoolStatsProviderpublic int getNumBeansInPool()
getNumBeansInPool in interface EJBPoolStatsProviderpublic int getNumThreadsWaiting()
getNumThreadsWaiting in interface EJBPoolStatsProviderpublic int getTotalBeansCreated()
getTotalBeansCreated in interface EJBPoolStatsProviderpublic int getTotalBeansDestroyed()
getTotalBeansDestroyed in interface EJBPoolStatsProviderpublic java.lang.String getAllMonitoredAttrbuteValues()
public java.lang.String getAllAttrValues()
protected void unregisterProbeProvider()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||