public class ObjectPool extends Object implements DynamicMBean
| Modifier and Type | Field and Description |
|---|---|
static String |
AVAILABLE |
static String |
CURRENT_POOL_SIZE |
static String |
MAX_CONCURRENCY |
static String |
POOL_MANAGER |
static String |
POOL_TYPE |
static String |
TOTAL_OBJECTS_CREATED |
static String |
TOTAL_OBJECTS_DESTROYED |
static String |
TOTAL_TIMES_ACQUIRED |
| Constructor and Description |
|---|
ObjectPool(String poolTypeName,
PoolableObjectCreator poolableObjectCreator)
Creates an ObjectPool with the specified PoolableObjectCreator and
assigns it to the supplied PoolType (poolTypeName) and default
poolManager.
|
ObjectPool(String poolTypeName,
String poolManagerName,
PoolableObjectCreator poolableObjectCreator)
Creates an ObjectPool with the specified PoolableObjectCreator and
assigns it to the supplied PoolType (poolTypeName) and poolManager
(poolManagerName).
|
| Modifier and Type | Method and Description |
|---|---|
Object |
acquirePoolableObject()
Returns an Object of the pool (one from the pool if it exists, otherwise,
creates a new one).
|
void |
clean()
Invoked by the PoolManager over a specified interval to shrink the pool
if necessary.
|
MBeanInfo |
createMBeanInfo()
Privately used function to create and return the MBeanInfo object
associated with this ObjectPool.
|
Object |
getAttribute(String attribute) |
AttributeList |
getAttributes(String[] attributes) |
MBeanInfo |
getMBeanInfo()
Provides lazy instantiation of the ObjectPool's MBeanInfo, yet allows for
reuse.
|
Object |
invoke(String actionName,
Object[] params,
String[] signature) |
static void |
registerManagement(String name,
ObjectPool objectPool)
Registers the ObjectPool's MBean.
|
void |
release(Object object)
Returns the supplied Object back to the pool.
|
void |
setAttribute(Attribute attribute) |
AttributeList |
setAttributes(AttributeList attributes) |
public static final String CURRENT_POOL_SIZE
public static final String AVAILABLE
public static final String TOTAL_OBJECTS_CREATED
public static final String TOTAL_OBJECTS_DESTROYED
public static final String TOTAL_TIMES_ACQUIRED
public static final String MAX_CONCURRENCY
public static final String POOL_TYPE
public static final String POOL_MANAGER
public ObjectPool(String poolTypeName, PoolableObjectCreator poolableObjectCreator)
poolTypeName - The name of the PoolType to associate the ObjectPool with.poolableObjectCreator - The PoolableObjectCreator used to create new Objects.public ObjectPool(String poolTypeName, String poolManagerName, PoolableObjectCreator poolableObjectCreator)
poolTypeName - The name of the PoolType to associate the ObjectPool with.poolManagerName - The name of the PoolManager to register the ObjectPool with.poolableObjectCreator - The PoolableObjectCreator used to create new Objects.public void release(Object object)
object - The Object to return to the pool.public Object acquirePoolableObject()
public void clean()
public static void registerManagement(String name, ObjectPool objectPool)
name - The name of the ObjectPool.objectPool - The ObjectPool to register.public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute in interface DynamicMBeanAttributeNotFoundExceptionMBeanExceptionReflectionExceptionpublic MBeanInfo getMBeanInfo()
getMBeanInfo in interface DynamicMBeanpublic MBeanInfo createMBeanInfo()
public AttributeList getAttributes(String[] attributes)
getAttributes in interface DynamicMBeanpublic Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
invoke in interface DynamicMBeanMBeanExceptionReflectionExceptionpublic AttributeList setAttributes(AttributeList attributes)
setAttributes in interface DynamicMBeanpublic void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute in interface DynamicMBeanAttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionExceptionCopyright © 2017 Pivotal Software, Inc.. All rights reserved.