private Integer getLargestValidPoolSize(Integer poolSize, Double forecast) {
        Integer largestPoolSize = -1;
        // find largest poolSize with valid data
        boolean validLargeData = false;
        while (!validLargeData) {
            largestPoolSize = threadStats.lastKey();
            ThroughputDistribution largestPoolSizeStats = getThroughputDistribution(largestPoolSize, false);;
            // prune any data that is too old or outside believable range
            if (pruneData(largestPoolSizeStats, forecast)) {
                threadStats.remove(largestPoolSize);
            } else {
                validLargeData = true;
            }
        }
        return largestPoolSize;
    }
private Integer getLargestValidPoolSize ( Integer poolSize , Double forecast ) { Integer largestPoolSize = - 1 ; boolean validLargeData = false ; while ( ! validLargeData ) { largestPoolSize = threadStats . lastKey ( ) ; ThroughputDistribution largestPoolSizeStats = getThroughputDistribution ( largestPoolSize , false ) ; ; if ( pruneData ( largestPoolSizeStats , forecast ) ) { threadStats . remove ( largestPoolSize ) ; } else { validLargeData = true ; } } return largestPoolSize ; }
Returns the largest valid poolSize in the current historical dataset.

@param poolSize - current poolSize
@param forecast - expected throughput at current poolSize
@return - largest valid poolSize found