numTestsPerEvictionRun 参数源码

package org.apache.commons.pool.impl

 

public class GenericObjectPool extends BaseObjectPool implements ObjectPool

 

    /** 

     * Returns the number of tests to be performed in an Evictor run,

     * based on the current value of numTestsPerEvictionRun

     * and the number of idle instances in the pool.

     * 

     * @see #setNumTestsPerEvictionRun

     * @return the number of tests for the Evictor to run

     */

    private int getNumTests() {

        if(_numTestsPerEvictionRun >= 0) {

            return Math.min(_numTestsPerEvictionRun, _pool.size());

        } else {

            return(int)(Math.ceil(_pool.size()/Math.abs((double)_numTestsPerEvictionRun)));

        }

    }

你可能感兴趣的:(numTestsPerEvictionRun 参数源码)