Search in sources :

Example 1 with Reset

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();
}
Also used : PoolStatus(com.sun.enterprise.resource.pool.PoolStatus) Reset(org.glassfish.external.statistics.annotations.Reset)

Example 2 with 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();
}
Also used : PoolStatus(com.sun.enterprise.resource.pool.PoolStatus) Reset(org.glassfish.external.statistics.annotations.Reset)

Example 3 with 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;
}
Also used : TreeNode(org.glassfish.flashlight.datatree.TreeNode) Method(java.lang.reflect.Method) Reset(org.glassfish.external.statistics.annotations.Reset) StatsProviderRegistryElement(org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement) ManagedAttribute(org.glassfish.gmbal.ManagedAttribute)

Aggregations

Reset (org.glassfish.external.statistics.annotations.Reset)3 PoolStatus (com.sun.enterprise.resource.pool.PoolStatus)2 Method (java.lang.reflect.Method)1 StatsProviderRegistryElement (org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement)1 TreeNode (org.glassfish.flashlight.datatree.TreeNode)1 ManagedAttribute (org.glassfish.gmbal.ManagedAttribute)1