Search in sources :

Example 1 with PoolStatus

use of com.sun.enterprise.resource.pool.PoolStatus 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 PoolStatus

use of com.sun.enterprise.resource.pool.PoolStatus 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 PoolStatus

use of com.sun.enterprise.resource.pool.PoolStatus in project Payara by payara.

the class ConnectionPoolHealthCheck method evaluatePoolUsage.

private void evaluatePoolUsage(HealthCheckResult result, PoolInfo poolInfo) {
    PoolStatus poolStatus = poolManager.getPoolStatus(poolInfo);
    if (poolStatus != null) {
        long usedConnection = poolStatus.getNumConnUsed();
        long freeConnection = poolStatus.getNumConnFree();
        long totalConnection = usedConnection + freeConnection;
        if (totalConnection > 0) {
            double usedPercentage = ((double) usedConnection / totalConnection) * 100;
            result.add(new HealthCheckResultEntry(decideOnStatusWithRatio(usedPercentage), poolInfo.getName() + " Usage (%): " + new DecimalFormat("#.00").format(usedPercentage)));
        }
    }
}
Also used : DecimalFormat(java.text.DecimalFormat) PoolStatus(com.sun.enterprise.resource.pool.PoolStatus) HealthCheckResultEntry(fish.payara.notification.healthcheck.HealthCheckResultEntry)

Aggregations

PoolStatus (com.sun.enterprise.resource.pool.PoolStatus)3 Reset (org.glassfish.external.statistics.annotations.Reset)2 HealthCheckResultEntry (fish.payara.notification.healthcheck.HealthCheckResultEntry)1 DecimalFormat (java.text.DecimalFormat)1