K
- Key type of the pooled objectsO
- Type of the pooled objects@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 and Description |
---|
ManagedObjectPool() |
Modifier and Type | Method and 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 com.levigo.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) |
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
protected abstract String getName()
protected abstract com.levigo.util.log.Logger getLogger()
protected abstract void doInvalidateObject(O object) throws Exception
Exception
protected abstract org.apache.commons.pool.impl.GenericKeyedObjectPool getPool()
public ObjectName getObjectName()
getObjectName
in interface org.springframework.jmx.export.naming.SelfNaming
@ManagedAttribute(description="Current number of active instances") public int getNumActive()
@ManagedAttribute(description="Current number of idle instances") public int getNumIdle()
@ManagedAttribute(description="Number of instances returned normally") public long getNumReturned()
@ManagedAttribute(description="Number of instances returned abnormally") public long getNumInvalidated()
@ManagedAttribute(description="Maximum number of idle instances") public int getMaxIdle()
@ManagedAttribute(description="Maximum number of idle instances") public void setMaxIdle(int maxIdle)
@ManagedAttribute(description="Maximum number of active instances") public int getMaxActive()
@ManagedAttribute(description="Maximum number of active instances") public void setMaxActive(int maxActive)
@ManagedOperation(description="Clear all instances from the pool") public void clearPool()
@ManagedOperation(description="Clear oldest 15% of instances from the pool.") public void clearOldest()
@ManagedAttribute(description="Period time when eviction thread should examine idle objects. (Value <= 0 deactivates eviction)") public long getTimeBetweenEvictionRunsMillis()
@ManagedAttribute(description="Period time when eviction thread should examine idle objects. (Value <= 0 deactivates eviction)") public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
@ManagedOperation(description="Run the pool eviction thread manually. This will remove instances which have become eligible for eviction.") public void evictPool() throws Exception
Exception
@ManagedAttribute(description="Minimum time after which an idle instance is evicted from the pool") public long getMinEvictableIdleTimeMillis()
@ManagedAttribute(description="Minimum time after which an idle instance is evicted from the pool") public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
@ManagedAttribute(description="Minimum number of idle instances that should survive the eviction") public int getMinIdle()
@ManagedAttribute(description="Minimum number of idle instances that should survive the eviction") public void setMinIdle(int minIdle)
@ManagedAttribute(description="Avg. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentAvgWaitingTime()
@ManagedAttribute(description="Min. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentMinWaitingTime()
@ManagedAttribute(description="Max. time taken for the last 10 accesses to the pool [milliseconds]") public long getRecentMaxWaitingTime()
@ManagedAttribute(description="Avg. time taken to access the pool [milliseconds]") public long getAvgWaitingTime()
@ManagedOperation(description="Clear all statistical data about pool access times") public void clearWaitingTimes()
Copyright © 2017 levigo holding gmbh. All rights reserved.