Class ManagedObjectPool<K,O>
- java.lang.Object
-
- com.levigo.jadice.server.core.util.ManagedObjectPool<K,O>
-
- Type Parameters:
K
- Key type of the pooled objectsO
- Type of the pooled objects
- All Implemented Interfaces:
SelfRegistering
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.jmx.export.naming.SelfNaming
- Direct Known Subclasses:
LibreOfficeInstancePool
,MSOfficeConverterPool
,XSLTransformerPool
@ManagedResource public abstract class ManagedObjectPool<K,O> extends Object implements org.springframework.jmx.export.naming.SelfNaming, SelfRegistering, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
A generic keyed pool that exposes all management functions and some statistical data via JMX.
-
-
Constructor Summary
Constructors Constructor Description ManagedObjectPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
O
borrowObject(K key)
void
clearOldest()
void
clearPool()
void
clearWaitingTimes()
void
destroy()
protected abstract O
doBorrowObject(K key)
protected abstract void
doInvalidateObject(O object)
protected abstract void
doReturnObject(O object)
void
evictPool()
long
getAvgWaitingTime()
protected abstract org.jadice.util.log.Logger
getLogger()
int
getMaxActive()
int
getMaxIdle()
long
getMinEvictableIdleTimeMillis()
int
getMinIdle()
protected abstract String
getName()
int
getNumActive()
int
getNumIdle()
long
getNumInvalidated()
long
getNumReturned()
ObjectName
getObjectName()
protected abstract org.apache.commons.pool.impl.GenericKeyedObjectPool
getPool()
long
getRecentAvgWaitingTime()
long
getRecentMaxWaitingTime()
long
getRecentMinWaitingTime()
long
getTimeBetweenEvictionRunsMillis()
void
invalidateObject(O object)
void
returnObject(O object)
void
setMaxActive(int maxActive)
void
setMaxIdle(int maxIdle)
void
setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
void
setMinIdle(int minIdle)
void
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
getName
protected abstract String getName()
-
getLogger
protected abstract org.jadice.util.log.Logger getLogger()
-
doInvalidateObject
protected abstract void doInvalidateObject(O object) throws Exception
- Throws:
Exception
-
getPool
protected abstract org.apache.commons.pool.impl.GenericKeyedObjectPool getPool()
-
getObjectName
public ObjectName getObjectName()
- Specified by:
getObjectName
in interfaceorg.springframework.jmx.export.naming.SelfNaming
-
getNumActive
@ManagedAttribute(description="Current number of active instances") public int getNumActive()
-
getNumIdle
@ManagedAttribute(description="Current number of idle instances") public int getNumIdle()
-
getNumReturned
@ManagedAttribute(description="Number of instances returned normally") public long getNumReturned()
-
getNumInvalidated
@ManagedAttribute(description="Number of instances returned abnormally") public long getNumInvalidated()
-
getMaxIdle
@ManagedAttribute(description="Maximum number of idle instances") public int getMaxIdle()
-
setMaxIdle
@ManagedAttribute(description="Maximum number of idle instances") public void setMaxIdle(int maxIdle)
-
getMaxActive
@ManagedAttribute(description="Maximum number of active instances") public int getMaxActive()
-
setMaxActive
@ManagedAttribute(description="Maximum number of active instances") public void setMaxActive(int maxActive)
-
clearPool
@ManagedOperation(description="Clear all instances from the pool") public void clearPool()
-
clearOldest
@ManagedOperation(description="Clear oldest 15% of instances from the pool.") public void clearOldest()
-
getTimeBetweenEvictionRunsMillis
@ManagedAttribute(description="Period time when eviction thread should examine idle objects. (Value <= 0 deactivates eviction)") public long getTimeBetweenEvictionRunsMillis()
-
setTimeBetweenEvictionRunsMillis
@ManagedAttribute(description="Period time when eviction thread should examine idle objects. (Value <= 0 deactivates eviction)") public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
-
evictPool
@ManagedOperation(description="Run the pool eviction thread manually. This will remove instances which have become eligible for eviction.") public void evictPool() throws Exception
- Throws:
Exception
-
getMinEvictableIdleTimeMillis
@ManagedAttribute(description="Minimum time after which an idle instance is evicted from the pool") public long getMinEvictableIdleTimeMillis()
-
setMinEvictableIdleTimeMillis
@ManagedAttribute(description="Minimum time after which an idle instance is evicted from the pool") public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
-
getMinIdle
@ManagedAttribute(description="Minimum number of idle instances that should survive the eviction") public int getMinIdle()
-
setMinIdle
@ManagedAttribute(description="Minimum number of idle instances that should survive the eviction") public void setMinIdle(int minIdle)
-
getRecentAvgWaitingTime
@ManagedAttribute(description="Avg. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentAvgWaitingTime()
-
getRecentMinWaitingTime
@ManagedAttribute(description="Min. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentMinWaitingTime()
-
getRecentMaxWaitingTime
@ManagedAttribute(description="Max. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentMaxWaitingTime()
-
getAvgWaitingTime
@ManagedAttribute(description="Avg. time taken to access the pool [milliseconds]") public long getAvgWaitingTime()
-
clearWaitingTimes
@ManagedOperation(description="Clear all statistical data about pool access times") public void clearWaitingTimes()
-
-