BlazePool<MyPoolable> pool = new BlazePool<MyPoolable>(...);
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("com.myapp:objectpool=stormpot");
server.registerMBean(pool, name);
@MXBean public interface ManagedPool
This is the JMX management interface for Stormpot object pools.
Using this interface, pools can be exposed to external management as an MXBean. Since its an MXBean, and not just an MBean, it imposes no requirement that external parties knows about the Stormpot types.
Once you have created your pool, it is easy to expose it through the platform MBeanServer, or any MBeanServer you like:
BlazePool<MyPoolable> pool = new BlazePool<MyPoolable>(...);
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("com.myapp:objectpool=stormpot");
server.registerMBean(pool, name);
Using the platform MBeanServer will make the pool visible to tools like JConsole and VisualVM.
| Modifier and Type | Method and Description |
|---|---|
long |
getAllocationCount()
Return the number of objects the pool has allocated since it was created.
|
double |
getAllocationFailureLatencyPercentile(double percentile) |
double |
getAllocationLatencyPercentile(double percentile) |
double |
getDeallocationLatencyPercentile(double percentile) |
long |
getFailedAllocationCount()
Return the number of allocations that has failed, either because the
allocator threw an exception or because it returned null, since the pool
was created.
|
long |
getLeakedObjectsCount()
If the pool is capable of precise object leak detection, this method will
return the number of object leaks that have been detected, and prevented,
since the pool was created.
|
double |
getObjectLifetimePercentile(double percentile) |
double |
getReallocationFailureLatencyPercentile(double percentile) |
double |
getReallocationLatencyPercentile(double percentile) |
int |
getTargetSize() |
boolean |
isShutDown()
Returns 'true' if the shut down process has been started on this pool,
'false' otherwise.
|
void |
setTargetSize(int size) |
long getAllocationCount()
Return the number of objects the pool has allocated since it was created.
long getFailedAllocationCount()
Return the number of allocations that has failed, either because the allocator threw an exception or because it returned null, since the pool was created.
long getLeakedObjectsCount()
If the pool is capable of precise object leak detection, this method will return the number of object leaks that have been detected, and prevented, since the pool was created. If the pool does not support precise object leak detection, then this method returns -1.
There are two kinds of leaks: One where the application forgets to release an object back to the pool, but keeps a strong reference to the object, and another where the application not only forgets to release the object, but also looses the reference to the object, making it eligible for garbage collection. The precise leak detector will only count leaks of the latter kind, where the leaked object has been garbage collected.
void setTargetSize(int size)
size - The new target size.ResizablePool.setTargetSize(int)int getTargetSize()
ResizablePool.getTargetSize()boolean isShutDown()
Returns 'true' if the shut down process has been started on this pool, 'false' otherwise. This method does not reveal whether or not the shut down process has completed.
LifecycledPool.shutdown() has been called on
this pool.double getObjectLifetimePercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder has been
configured for the pool.MetricsRecorder.getObjectLifetimePercentile(double)double getAllocationLatencyPercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder
has been configured for the pool.MetricsRecorder.getAllocationLatencyPercentile(double)double getAllocationFailureLatencyPercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder has been configured for the pool.MetricsRecorder.getAllocationFailureLatencyPercentile(double)double getReallocationLatencyPercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder has been configured for the pool.MetricsRecorder.getReallocationLatencyPercentile(double)double getReallocationFailureLatencyPercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder has been configured for the pool.MetricsRecorder.getReallocationFailurePercentile(double)double getDeallocationLatencyPercentile(double percentile)
percentile - The percentile to get, as a decimal, e.g. a number
between 0.0 and 1.0.MetricsRecorder has been configured for
the pool.MetricsRecorder.getDeallocationLatencyPercentile(double)Copyright © 2011-2014–2015. All rights reserved.