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

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

Introduction

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

Prototype

public boolean getTestOnCreate() 

Source Link

Document

Get the value for the testOnCreate 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}.
 *///w  w w .  ja  va 2s  . 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./*  w  w  w  .ja va  2  s  .  c o  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());
}