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.
Modifier and Type | Field and 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 and Description |
---|
AbstractPool() |
Modifier and Type | Method and Description |
---|---|
void |
appendStats(StringBuffer 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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroyObject, getObject, returnObject
protected static final Logger _logger
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 ClassLoader containerClassLoader
protected int destroyedCount
protected int poolSuccess
protected String poolName
protected int poolReturned
protected String configData
protected EjbPoolProbeProvider poolProbeNotifier
protected String appName
protected String modName
protected String ejbName
protected long beanId
public void setContainerClassLoader(ClassLoader loader)
public Object getObject(boolean canWait, Object param) throws PoolException
getObject
in interface Pool
PoolException
public Object getObject(long maxWaitTime, Object param) throws PoolException
getObject
in interface Pool
PoolException
protected abstract void removeIdleObjects()
public abstract void close()
public int getCreatedCount()
public int getDestroyedCount()
public int getPoolSuccess()
public int getSize()
public int getWaitCount()
public int getSteadyPoolSize()
public int getResizeQuantity()
public int getMaxPoolSize()
public long getMaxWaitTimeInMillis()
public int getIdleTimeoutInSeconds()
public void setConfigData(String configData)
public void appendStats(StringBuffer sbuf)
public int getJmsMaxMessagesLoad()
public int getNumBeansInPool()
public int getNumThreadsWaiting()
public int getTotalBeansCreated()
public int getTotalBeansDestroyed()
public String getAllMonitoredAttrbuteValues()
public String getAllAttrValues()
protected void unregisterProbeProvider()
Copyright © 2018. All rights reserved.