Example usage for org.apache.commons.pool2.impl GenericObjectPoolConfig getFairness

List of usage examples for org.apache.commons.pool2.impl GenericObjectPoolConfig getFairness

Introduction

In this page you can find the example usage for org.apache.commons.pool2.impl GenericObjectPoolConfig getFairness.

Prototype

public boolean getFairness() 

Source Link

Document

Get the value for the fairness configuration attribute for pools created with this configuration instance.

Usage

From source file:JDBCPool.dbcp.demo.sourcecode.GenericObjectPool.java

/**
 * Create a new <code>GenericObjectPool</code> using a specific
 * configuration.//from  w  w  w  .ja va2s  .c  o m
 *
 * @param factory   The object factory to be used to create object instances
 *                  used by this pool
 * @param config    The configuration to use for this pool instance. The
 *                  configuration is used by value. Subsequent changes to
 *                  the configuration object will not be reflected in the
 *                  pool.
 */
public GenericObjectPool(PooledObjectFactory<T> factory, GenericObjectPoolConfig config) {

    super(config, ONAME_BASE, config.getJmxNamePrefix());

    if (factory == null) {
        jmxUnregister(); // tidy up
        throw new IllegalArgumentException("factory may not be null");
    }
    this.factory = factory;

    idleObjects = new LinkedBlockingDeque<PooledObject<T>>(config.getFairness());

    setConfig(config);

    startEvictor(getTimeBetweenEvictionRunsMillis());
}