/** Return the number of free connections available to an application right away (excluding connections that can be * created dynamically) * @return number of free connections */ public int getTotalFree(){ int total=0; for (int i=0; i < this.partitionCount && this.partitions[i] != null ; i++){ total+=this.partitions[i].getAvailableConnections(); } return total; }
/** * Return the number of free connections available to an application right away (excluding connections that can be * created dynamically) * * @return number of free connections */ public int getTotalFree() { int total = 0; for (int i = 0; i < this.partitionCount && this.partitions[i] != null; i++) { total += this.partitions[i].getAvailableConnections(); } return total; }
/** Return total number of connections currently in use by an application * @return no of leased connections */ public int getTotalLeased(){ int total=0; for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){ total+=this.partitions[i].getCreatedConnections()-this.partitions[i].getAvailableConnections(); } return total; }
/** * Return total number of connections currently in use by an application * * @return no of leased connections */ public int getTotalLeased() { int total = 0; for (int i = 0; i < this.partitionCount && this.partitions[i] != null; i++) { total += this.partitions[i].getCreatedConnections() - this.partitions[i].getAvailableConnections(); } return total; }
/** * Tests if this partition has hit a threshold and signal to the pool watch thread to create new connections * * @param connectionPartition to test for. */ protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) { if (!connectionPartition.isUnableToCreateMoreTransactions() && !this.poolShuttingDown && connectionPartition.getAvailableConnections() * 100 / connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold) { connectionPartition.getPoolWatchThreadSignalQueue().offer(new Object()); // item being pushed is not important. } }
/** * Tests if this partition has hit a threshold and signal to the pool watch thread to create new connections * @param connectionPartition to test for. */ protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) { if (!connectionPartition.isUnableToCreateMoreTransactions() && !this.poolShuttingDown && connectionPartition.getAvailableConnections()*100/connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold){ connectionPartition.getPoolWatchThreadSignalQueue().offer(new Object()); // item being pushed is not important. } }
long nextCheckInMs = this.maxAgeInMs; int partitionSize= this.partition.getAvailableConnections(); long currentTime = System.currentTimeMillis(); for (int i=0; i < partitionSize; i++){
int partitionSize= this.partition.getAvailableConnections(); long currentTimeInMs = System.currentTimeMillis();
while (maxNewConnections == 0 || (this.partition.getAvailableConnections() *100/this.partition.getMaxConnections() > this.poolAvailabilityThreshold)){ if (maxNewConnections == 0){ this.partition.setUnableToCreateMoreTransactions(true);