Class AbstractPool
- java.lang.Object
-
- com.sun.ejb.containers.util.pool.AbstractPool
-
- All Implemented Interfaces:
Pool
- Direct Known Subclasses:
NonBlockingPool
public abstract class AbstractPool extends Object implements Pool
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
Fields Modifier and Type Field Description protected static Logger_loggerprotected StringappNameprotected longbeanIdprotected StringconfigDataprotected ClassLoadercontainerClassLoaderprotected intcreatedCountprotected intdestroyedCountprotected StringejbNameprotected ObjectFactoryfactoryprotected intidleTimeoutInSecondsprotected ArrayList<Object>listprotected intmaxPoolSizeprotected longmaxWaitTimeInMillisprotected StringmodNameprotected StringpoolNameprotected EjbPoolProbeProviderpoolProbeNotifierprotected intpoolReturnedprotected intpoolSuccessprotected intresizeQuantityprotected intsteadyPoolSizeprotected intwaitCount
-
Constructor Summary
Constructors Constructor Description AbstractPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidappendStats(StringBuilder sbuf)abstract voidclose()StringgetAllAttrValues()StringgetAllMonitoredAttrbuteValues()intgetCreatedCount()intgetDestroyedCount()intgetIdleTimeoutInSeconds()intgetJmsMaxMessagesLoad()intgetMaxPoolSize()longgetMaxWaitTimeInMillis()intgetNumBeansInPool()intgetNumThreadsWaiting()ObjectgetObject(boolean canWait, Object param)ObjectgetObject(long maxWaitTime, Object param)intgetPoolSuccess()intgetResizeQuantity()intgetSize()intgetSteadyPoolSize()intgetTotalBeansCreated()intgetTotalBeansDestroyed()intgetWaitCount()protected abstract voidremoveIdleObjects()voidsetConfigData(String configData)voidsetContainerClassLoader(ClassLoader loader)voidsetInfo(String appName, String modName, String ejbName)protected voidunregisterProbeProvider()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.ejb.containers.util.pool.Pool
destroyObject, getObject, returnObject
-
-
-
-
Field Detail
-
_logger
protected static final Logger _logger
-
factory
protected ObjectFactory factory
-
waitCount
protected int waitCount
-
createdCount
protected int createdCount
-
steadyPoolSize
protected int steadyPoolSize
-
resizeQuantity
protected int resizeQuantity
-
maxPoolSize
protected int maxPoolSize
-
maxWaitTimeInMillis
protected long maxWaitTimeInMillis
-
idleTimeoutInSeconds
protected int idleTimeoutInSeconds
-
containerClassLoader
protected ClassLoader containerClassLoader
-
destroyedCount
protected int destroyedCount
-
poolSuccess
protected int poolSuccess
-
poolName
protected String poolName
-
poolReturned
protected int poolReturned
-
configData
protected String configData
-
poolProbeNotifier
protected EjbPoolProbeProvider poolProbeNotifier
-
appName
protected String appName
-
modName
protected String modName
-
ejbName
protected String ejbName
-
beanId
protected long beanId
-
-
Method Detail
-
setContainerClassLoader
public void setContainerClassLoader(ClassLoader loader)
-
getObject
public Object getObject(boolean canWait, Object param) throws PoolException
- Specified by:
getObjectin interfacePool- Returns:
- Throws:
PoolException
-
getObject
public Object getObject(long maxWaitTime, Object param) throws PoolException
- Specified by:
getObjectin interfacePool- Returns:
- Throws:
PoolException
-
removeIdleObjects
protected abstract void removeIdleObjects()
-
close
public abstract void close()
-
getCreatedCount
public int getCreatedCount()
-
getDestroyedCount
public int getDestroyedCount()
-
getPoolSuccess
public int getPoolSuccess()
-
getSize
public int getSize()
-
getWaitCount
public int getWaitCount()
-
getSteadyPoolSize
public int getSteadyPoolSize()
-
getResizeQuantity
public int getResizeQuantity()
-
getMaxPoolSize
public int getMaxPoolSize()
-
getMaxWaitTimeInMillis
public long getMaxWaitTimeInMillis()
-
getIdleTimeoutInSeconds
public int getIdleTimeoutInSeconds()
-
setConfigData
public void setConfigData(String configData)
-
appendStats
public void appendStats(StringBuilder sbuf)
-
getJmsMaxMessagesLoad
public int getJmsMaxMessagesLoad()
-
getNumBeansInPool
public int getNumBeansInPool()
-
getNumThreadsWaiting
public int getNumThreadsWaiting()
-
getTotalBeansCreated
public int getTotalBeansCreated()
-
getTotalBeansDestroyed
public int getTotalBeansDestroyed()
-
getAllMonitoredAttrbuteValues
public String getAllMonitoredAttrbuteValues()
-
getAllAttrValues
public String getAllAttrValues()
-
unregisterProbeProvider
protected void unregisterProbeProvider()
-
-