public class NonBlockingPool extends AbstractPool
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.
Modifier and Type | Field and Description |
---|---|
protected boolean |
addedIdleBeanWork |
protected boolean |
addedResizeTask |
protected boolean |
inResizing |
protected boolean |
singletonBeanPool
If glassfish-ejb-jar.xml
|
_logger, appName, beanId, configData, containerClassLoader, createdCount, destroyedCount, ejbName, factory, idleTimeoutInSeconds, list, maxPoolSize, maxWaitTimeInMillis, modName, poolName, poolProbeNotifier, poolReturned, poolSuccess, resizeQuantity, steadyPoolSize, waitCount
Modifier | Constructor and Description |
---|---|
protected |
NonBlockingPool() |
|
NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader) |
|
NonBlockingPool(long beanId,
String poolName,
ObjectFactory factory,
int steadyPoolSize,
int resizeQuantity,
int maxPoolSize,
int idleTimeoutInSeconds,
ClassLoader loader,
boolean singletonBeanPool) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the pool
|
void |
destroyObject(Object object)
Destroys an Object.
|
protected void |
doResize() |
String |
getAllAttrValues() |
Object |
getObject(Object param)
Get an object from the pool within the specified time.
|
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(Object object)
Return an object back to the pool.
|
appendStats, getAllMonitoredAttrbuteValues, getCreatedCount, getDestroyedCount, getIdleTimeoutInSeconds, getJmsMaxMessagesLoad, getMaxPoolSize, getMaxWaitTimeInMillis, getNumBeansInPool, getNumThreadsWaiting, getObject, getObject, getPoolSuccess, getResizeQuantity, getSize, getSteadyPoolSize, getTotalBeansCreated, getTotalBeansDestroyed, getWaitCount, setConfigData, setContainerClassLoader, setInfo, unregisterProbeProvider
protected boolean addedResizeTask
protected volatile boolean addedIdleBeanWork
protected boolean inResizing
protected boolean singletonBeanPool
protected NonBlockingPool()
public NonBlockingPool(long beanId, String poolName, ObjectFactory factory, int steadyPoolSize, int resizeQuantity, int maxPoolSize, int idleTimeoutInSeconds, ClassLoader loader)
public NonBlockingPool(long beanId, String poolName, ObjectFactory factory, int steadyPoolSize, int resizeQuantity, int maxPoolSize, int idleTimeoutInSeconds, ClassLoader loader, boolean singletonBeanPool)
public Object getObject(Object param)
Pool
public void returnObject(Object object)
object
- public void destroyObject(Object object)
object
- Object to be destroyed.protected void preload(int count)
count
- 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 AbstractPool
protected void remove(int count)
protected void removeIdleObjects()
removeIdleObjects
in class AbstractPool
protected void doResize()
public String getAllAttrValues()
getAllAttrValues
in class AbstractPool
Copyright © 2019. All rights reserved.