/** * 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); } } }
/** * 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); } } }