use of org.glassfish.external.statistics.annotations.Reset in project Payara by payara.
the class ConnectorConnPoolStatsProvider method reset.
/**
* Reset pool statistics
* When annotated with @Reset, this method is invoked whenever monitoring
* is turned to HIGH from OFF, thereby setting the statistics to
* appropriate values.
*/
@Reset
public void reset() {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Reset event received - poolName = " + poolInfo);
}
PoolStatus status = ConnectorRuntime.getRuntime().getPoolManager().getPoolStatus(poolInfo);
numConnUsed.setCurrent(status.getNumConnUsed());
numConnFree.setCurrent(status.getNumConnFree());
numConnCreated.reset();
numConnDestroyed.reset();
numConnFailedValidation.reset();
numConnTimedOut.reset();
numConnAcquired.reset();
numConnReleased.reset();
connRequestWaitTime.reset();
numConnSuccessfullyMatched.reset();
numConnNotSuccessfullyMatched.reset();
numPotentialConnLeak.reset();
averageConnWaitTime.reset();
totalConnRequestWaitTime.reset();
waitQueueLength.reset();
}
use of org.glassfish.external.statistics.annotations.Reset in project Payara by payara.
the class JdbcConnPoolStatsProvider method reset.
/**
* Reset pool statistics.
* When annotated with @Reset, this method is invoked whenever monitoring
* is turned to HIGH from OFF, thereby setting the statistics to
* appropriate values.
*/
@Reset
public void reset() {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Reset event received - poolInfo = " + poolInfo);
}
PoolStatus status = ConnectorRuntime.getRuntime().getPoolManager().getPoolStatus(poolInfo);
numConnUsed.setCurrent(status.getNumConnUsed());
numConnFree.setCurrent(status.getNumConnFree());
numConnCreated.reset();
numConnDestroyed.reset();
numConnFailedValidation.reset();
numConnTimedOut.reset();
numConnAcquired.reset();
numConnReleased.reset();
connRequestWaitTime.reset();
numConnSuccessfullyMatched.reset();
numConnNotSuccessfullyMatched.reset();
numPotentialConnLeak.reset();
averageConnWaitTime.reset();
totalConnRequestWaitTime.reset();
waitQueueLength.reset();
}
use of org.glassfish.external.statistics.annotations.Reset in project Payara by payara.
the class StatsProviderManagerDelegateImpl method createTreeForStatsProvider.
private List<String> createTreeForStatsProvider(TreeNode parentNode, Object statsProvider) {
/* construct monitoring tree at PluginPoint using subTreePath */
List<String> childNodeNames = new ArrayList();
/* Check for custom reset method and store for later to be called instead of
standard reset methods on Statistic classes*/
for (Method m : statsProvider.getClass().getMethods()) {
ManagedAttribute ma = m.getAnnotation(ManagedAttribute.class);
Reset resetMeth = m.getAnnotation(Reset.class);
if (resetMeth != null) {
StatsProviderRegistryElement spre = this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
spre.setResetMethod(m);
}
if (ma != null) {
String methodName = m.getName();
String id = ma.id();
if ((id == null) || id.isEmpty()) {
// if id not specified, derive from method name
String methodNameLower = methodName.toLowerCase(Locale.ENGLISH);
if (methodNameLower.startsWith("get") && methodNameLower.length() > 3) {
id = methodNameLower.substring(3);
}
}
TreeNode attrNode = TreeNodeFactory.createMethodInvoker(id, statsProvider, id, m);
parentNode.addChild(attrNode);
childNodeNames.add(attrNode.getName());
}
}
return childNodeNames;
}
Aggregations