Package org.apache.tomcat.dbcp.pool2.impl

Examples of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig


    public JedisPool(final URI uri) {
  this(new GenericObjectPoolConfig(), uri, Protocol.DEFAULT_TIMEOUT);
    }

    public JedisPool(final URI uri, final int timeout) {
  this(new GenericObjectPoolConfig(), uri, timeout);
    }
View Full Code Here


  }

  @Override
  public void start() {
    super.start();
    pool = new JedisPool(new GenericObjectPoolConfig(), host, port,
        timeout, password, database);
  }
View Full Code Here

            password = uri.getUserInfo().split(":", 2)[1];
          }
          if (uri.getPath().indexOf('/') > -1) {
            database = Integer.parseInt(uri.getPath().split("/", 2)[1]);
          }
          pool = new JedisPool(new GenericObjectPoolConfig(), uri.getHost(), uri.getPort(), Protocol.DEFAULT_TIMEOUT, password, database);
        } else {
          pool = new JedisPool(url);
        }
      } catch (JedisException e) {
        log.error("failed to create a Redis pool!", e);
View Full Code Here

    public static ObjectPool<SVNClientManager> clientManagerPoolWithAuth(final String username, final String password) {
        return createObjectPool(new SVNClientManagerFactory(username, password));
    }

    private static <T> ObjectPool<T> createObjectPool(final PooledObjectFactory<T> factory) {
        final GenericObjectPoolConfig objectPoolConfig = new GenericObjectPoolConfig();
        objectPoolConfig.setMinEvictableIdleTimeMillis(TimeUnit.HOURS.toMillis(1)); // arbitrary, but positive so objects do get evicted
        objectPoolConfig.setTimeBetweenEvictionRunsMillis(TimeUnit.MINUTES.toMillis(10)); // arbitrary, but positive so objects do get evicted
        objectPoolConfig.setJmxEnabled(false);
        objectPoolConfig.setBlockWhenExhausted(false);
        objectPoolConfig.setMaxTotal(-1); // uncapped number of objects in the pool
        final AbandonedConfig abandonedConfig = new AbandonedConfig();
        abandonedConfig.setRemoveAbandonedOnBorrow(true);
        abandonedConfig.setRemoveAbandonedTimeout((int) TimeUnit.MINUTES.toSeconds(30));
        return new GenericObjectPool<T>(factory, objectPoolConfig, abandonedConfig);
    }
View Full Code Here

            password = uri.getUserInfo().split(":", 2)[1];
          }
          if (uri.getPath().indexOf('/') > -1) {
            database = Integer.parseInt(uri.getPath().split("/", 2)[1]);
          }
          pool = new JedisPool(new GenericObjectPoolConfig(), uri.getHost(), uri.getPort(), Protocol.DEFAULT_TIMEOUT, password, database);
        } else {
          pool = new JedisPool(url);
        }
      } catch (JedisException e) {
        log.error("failed to create a Redis pool!", e);
View Full Code Here

    private CloseEvents closeEvents = new CloseEvents();

    public RedisConnectionPool(RedisConnectionProvider<T> redisConnectionProvider, int maxActive, int maxIdle, long maxWait) {
        this.redisConnectionProvider = redisConnectionProvider;

        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setMaxIdle(maxIdle);
        config.setMaxTotal(maxActive);
        config.setMaxWaitMillis(maxWait);
        config.setTestOnBorrow(true);

        objectPool = new GenericObjectPool<T>(createFactory(redisConnectionProvider), config);
    }
View Full Code Here

  public AbstractPool(ThriftInterfaceConfiguration apiConfig) {
    this.apiConfig = apiConfig;
  }

  protected void init(BasePooledObjectFactory<T> factory) {
    GenericObjectPoolConfig config = new GenericObjectPoolConfig();
    config.setMinIdle(apiConfig.getClientPoolSize());
    config.setTestOnBorrow(true);
    config.setTestOnReturn(true);
    this.pool = PoolUtils.erodingPool(new GenericObjectPool<>(factory,
        config));
  }
View Full Code Here

        abandonedConfig.setRemoveAbandonedOnBorrow(true);
        abandonedConfig.setUseUsageTracking(true);
        abandonedConfig.setRemoveAbandonedTimeout(ABANDONED_TIMEOUT_SECS);
        abandonedConfig.setLogWriter(pw);

        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setMaxTotal(3);

        PooledObjectFactory<TestObject> factory = new TestObjectFactory();

        ObjectPool<TestObject> innerPool =
                new GenericObjectPool<TestObject>(factory, config, abandonedConfig);
View Full Code Here

        pcf.setMaxOpenPrepatedStatements(10);
        pcf.setValidationQuery("SELECT COUNT(*) FROM DUAL");
        pcf.setDefaultReadOnly(Boolean.FALSE);
        pcf.setDefaultAutoCommit(Boolean.TRUE);

        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
        poolConfig.setMaxTotal(getMaxTotal());
        poolConfig.setMaxWaitMillis(getMaxWaitMillis());
        poolConfig.setMinIdle(10);
        poolConfig.setTestOnBorrow(true);
        poolConfig.setTestOnReturn(true);
        poolConfig.setTestWhileIdle(true);
        poolConfig.setTimeBetweenEvictionRunsMillis(10000L);
        poolConfig.setNumTestsPerEvictionRun(5);
        poolConfig.setMinEvictableIdleTimeMillis(5000L);

        GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<>(pcf, poolConfig);
        pcf.setPool(pool);

        assertNotNull(pcf);
View Full Code Here

        assertFalse(conn2.isClosed());
    }

    /** @see "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
    public void testReportedBug12400() throws Exception {
        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setMaxTotal(70);
        config.setMaxWaitMillis(60000);
        config.setMaxIdle(10);
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
            "jdbc:apache:commons:testdriver",
            "username",
            "password");
        PoolableConnectionFactory poolableConnectionFactory =
View Full Code Here

TOP

Related Classes of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.