/** * Increment numconnfree event * * @param poolName * @param steadyPoolSize */ @ProbeListener(JDBC_PROBE_LISTENER + "incrementNumConnFreeEvent") public void incrementNumConnFreeEvent( @ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("beingDestroyed") boolean beingDestroyed, @ProbeParam("steadyPoolSize") int steadyPoolSize) { // handle the num conn free increment event PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName); if (this.poolInfo.equals(poolInfo)) { if (logger.isLoggable(Level.FINEST)) { logger.finest("Increment Num Connections Free event received - poolName = " + poolName); } if (beingDestroyed) { // if pruned by resizer thread synchronized (numConnFree) { synchronized (numConnUsed) { if (numConnFree.getCurrent() + numConnUsed.getCurrent() < steadyPoolSize) { numConnFree.setCurrent(numConnFree.getCurrent() + 1); } } } } else { synchronized (numConnFree) { numConnFree.setCurrent(numConnFree.getCurrent() + 1); } } } }
/** * Connections freed event * * @param poolName * @param count number of connections freed to the pool */ @ProbeListener(JDBC_PROBE_LISTENER + "connectionsFreedEvent") public void connectionsFreedEvent( @ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("count") int count) { // handle the connections freed event PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName); if (this.poolInfo.equals(poolInfo)) { if (logger.isLoggable(Level.FINEST)) { logger.finest("Connections Freed event received - poolName = " + poolName); logger.finest( "numConnUsed =" + numConnUsed.getCurrent() + " numConnFree=" + numConnFree.getCurrent() + " Number of connections freed =" + count); } // set numConnFree to the count value synchronized (numConnFree) { numConnFree.setCurrent(count); } } }
/** * 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(); }
/** * Event that a connection request is served in timeTakenInMillis. * * @param poolName * @param timeTakenInMillis */ @ProbeListener(JDBC_PROBE_LISTENER + "connectionRequestServedEvent") public void connectionRequestServedEvent( @ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("timeTakenInMillis") long timeTakenInMillis) { PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName); if (this.poolInfo.equals(poolInfo)) { if (logger.isLoggable(Level.FINEST)) { logger.finest("Connection request served event received - " + "poolName = " + poolName); } connRequestWaitTime.setCurrent(timeTakenInMillis); totalConnRequestWaitTime.increment(timeTakenInMillis); } }
/** * Connection used event * * @param poolName */ @ProbeListener(JDBC_PROBE_LISTENER + "connectionUsedEvent") public void connectionUsedEvent( @ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName) { // handle the connection used event PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName); if (this.poolInfo.equals(poolInfo)) { if (logger.isLoggable(Level.FINEST)) { logger.finest("Connection Used event received - poolName = " + poolName); } // increment numConnUsed synchronized (numConnUsed) { numConnUsed.setCurrent(numConnUsed.getCurrent() + 1); } } }
/** * Decrement numconnfree event * * @param poolName * @param steadyPoolSize */ @ProbeListener(JDBC_PROBE_LISTENER + "decrementNumConnFreeEvent") public void decrementNumConnFreeEvent( @ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName) { // handle the num conn free decrement event PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName); if (this.poolInfo.equals(poolInfo)) { if (logger.isLoggable(Level.FINEST)) { logger.finest("Decrement Num Connections Free event received - poolName = " + poolName); } // Decrement counter synchronized (numConnFree) { numConnFree.setCurrent(numConnFree.getCurrent() - 1); } } }