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

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

Introduction

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

Prototype

public boolean getTestOnReturn() 

Source Link

Document

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

Usage

From source file:io.lettuce.core.support.CommonsPool2ConfigConverter.java

/**
 * Converts {@link GenericObjectPoolConfig} properties to an immutable {@link BoundedPoolConfig}. Applies max total, min/max
 * idle and test on borrow/create/release configuration.
 *
 * @param config must not be {@literal null}.
 * @return the converted {@link BoundedPoolConfig}.
 *//*from w  w w. j a v a 2 s  .c o m*/
public static BoundedPoolConfig bounded(GenericObjectPoolConfig config) {

    LettuceAssert.notNull(config, "GenericObjectPoolConfig must not be null");

    return BoundedPoolConfig.builder().maxTotal(config.getMaxTotal()).maxIdle(config.getMaxIdle())
            .minIdle(config.getMinIdle()).testOnAcquire(config.getTestOnBorrow())
            .testOnCreate(config.getTestOnCreate()).testOnRelease(config.getTestOnReturn()).build();
}

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

/**
 * Sets the base pool configuration./*from   w ww. j  av  a 2  s .  co m*/
 *
 * @param conf the new configuration to use. This is used by value.
 *
 * @see GenericObjectPoolConfig
 */
public void setConfig(GenericObjectPoolConfig conf) {
    setLifo(conf.getLifo());
    setMaxIdle(conf.getMaxIdle());
    setMinIdle(conf.getMinIdle());
    setMaxTotal(conf.getMaxTotal());
    setMaxWaitMillis(conf.getMaxWaitMillis());
    setBlockWhenExhausted(conf.getBlockWhenExhausted());
    setTestOnCreate(conf.getTestOnCreate());
    setTestOnBorrow(conf.getTestOnBorrow());
    setTestOnReturn(conf.getTestOnReturn());
    setTestWhileIdle(conf.getTestWhileIdle());
    setNumTestsPerEvictionRun(conf.getNumTestsPerEvictionRun());
    setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis());
    setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMillis());
    setSoftMinEvictableIdleTimeMillis(conf.getSoftMinEvictableIdleTimeMillis());
    setEvictionPolicyClassName(conf.getEvictionPolicyClassName());
}