private Integer getSmallestValidPoolSize ( Integer poolSize , Double forecast ) { Integer smallestPoolSize = threadStats . firstKey ( ) ; Integer nextPoolSize = threadStats . higherKey ( smallestPoolSize ) ; Integer pruneSize = - 1 ; boolean validSmallData = false ; while ( ! validSmallData && nextPoolSize != null ) { ThroughputDistribution smallestPoolSizeStats = getThroughputDistribution ( smallestPoolSize , false ) ; ; // prune data that is too old or outside believable range if ( pruneData ( smallestPoolSizeStats , forecast ) ) { pruneSize = smallestPoolSize ; smallestPoolSize = nextPoolSize ; nextPoolSize = threadStats . higherKey ( smallestPoolSize ) ; if ( pruneSize > hangBufferPoolSize && pruneSize > coreThreads ) { threadStats . remove ( pruneSize ) ; } } else { validSmallData = true ; } } return smallestPoolSize ; }
Returns the smallest valid poolSize in the current historical dataset .