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
_logger
protected String
appName
protected long
beanId
protected String
configData
protected ClassLoader
containerClassLoader
protected int
createdCount
protected int
destroyedCount
protected String
ejbName
protected ObjectFactory
factory
protected int
idleTimeoutInSeconds
protected ArrayList<Object>
list
protected int
maxPoolSize
protected long
maxWaitTimeInMillis
protected String
modName
protected String
poolName
protected EjbPoolProbeProvider
poolProbeNotifier
protected int
poolReturned
protected int
poolSuccess
protected int
resizeQuantity
protected int
steadyPoolSize
protected int
waitCount
-
Constructor Summary
Constructors Constructor Description AbstractPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
appendStats(StringBuilder sbuf)
abstract void
close()
String
getAllAttrValues()
String
getAllMonitoredAttrbuteValues()
int
getCreatedCount()
int
getDestroyedCount()
int
getIdleTimeoutInSeconds()
int
getJmsMaxMessagesLoad()
int
getMaxPoolSize()
long
getMaxWaitTimeInMillis()
int
getNumBeansInPool()
int
getNumThreadsWaiting()
Object
getObject(boolean canWait, Object param)
Object
getObject(long maxWaitTime, Object param)
int
getPoolSuccess()
int
getResizeQuantity()
int
getSize()
int
getSteadyPoolSize()
int
getTotalBeansCreated()
int
getTotalBeansDestroyed()
int
getWaitCount()
protected abstract void
removeIdleObjects()
void
setConfigData(String configData)
void
setContainerClassLoader(ClassLoader loader)
void
setInfo(String appName, String modName, String ejbName)
protected void
unregisterProbeProvider()
-
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:
getObject
in interfacePool
- Returns:
- Throws:
PoolException
-
getObject
public Object getObject(long maxWaitTime, Object param) throws PoolException
- Specified by:
getObject
in 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()
-
-