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

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


            new PoolableConnectionFactory(connFactory, oName);
        pcf.setPoolStatements(true);
        pcf.setDefaultReadOnly(Boolean.FALSE);
        pcf.setDefaultAutoCommit(Boolean.TRUE);

        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setJmxNameBase("UnitTests:DataSource=test,connectionpool=connections");
        config.setJmxNamePrefix("");
        ObjectPool<PoolableConnection> connPool =
                new GenericObjectPool<>(pcf, config);
        pcf.setPool(connPool);

        DataSource ds = new PoolingDataSource<>(connPool);
View Full Code Here


     * @return a GenericObjectPoolConfig configured with: maxActive=-1,
     *         maxIdle=10, minIdle=1, testOnBorrow=true,
     *         blockWhenExhausted=false
     */
    public static GenericObjectPoolConfig getDefaultPoolConfig() {
        final GenericObjectPoolConfig cfg = new GenericObjectPoolConfig();
        cfg.setMaxTotal(-1); // Infinite
        cfg.setMaxIdle(10);
        cfg.setMinIdle(1);
        cfg.setTestOnBorrow(true);
        cfg.setBlockWhenExhausted(false);
        return cfg;
    }
View Full Code Here

   *
   * @param hostName The Redis host
   * @param port The Redis port
   */
  public JredisPool(String hostName, int port) {
    this(hostName, port, 0, null, 0, new GenericObjectPoolConfig());
  }
View Full Code Here

   * Uses the {@link Config} defaults for configuring the connection pool
   *
   * @param connectionSpec The {@link ConnectionSpec} for connecting to Redis
   */
  public JredisPool(ConnectionSpec connectionSpec) {
    this.internalPool = new GenericObjectPool<JRedis>(new JredisFactory(connectionSpec), new GenericObjectPoolConfig());
  }
View Full Code Here

   *          supported, it is assumed that connections can be re-used without subsequent selects.
   * @param password The password used for authenticating with the Redis server or null if no password required
   * @param timeout The socket timeout or 0 to use the default socket timeout
   */
  public JredisPool(String hostName, int port, int dbIndex, String password, int timeout) {
    this(hostName, port, dbIndex, password, timeout, new GenericObjectPoolConfig());
  }
View Full Code Here

    conn2.ping();
  }

  @Test
  public void testConnectionNotReturnedOnException() {
    GenericObjectPoolConfig config = new GenericObjectPoolConfig();
    config.setMaxTotal(1);
    config.setMaxWaitMillis(1);
    JredisConnectionFactory factory2 = new JredisConnectionFactory(new JredisPool(SettingsUtils.getHost(),
        SettingsUtils.getPort(), config));
    RedisConnection conn2 = factory2.getConnection();
    ((JRedis) conn2.getNativeConnection()).quit();
    try {
View Full Code Here

    client.close();
  }

  @Test
  public void testGetResourcePoolExhausted() {
    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxTotal(1);
    poolConfig.setMaxWaitMillis(1);
    this.pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort(), poolConfig);
    pool.afterPropertiesSet();
    RedisAsyncConnection<byte[], byte[]> client = pool.getResource();
    assertNotNull(client);
    try {
View Full Code Here

    pool.getResource();
  }

  @Test
  public void testReturnResource() {
    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxTotal(1);
    poolConfig.setMaxWaitMillis(1);
    this.pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort(), poolConfig);
    pool.afterPropertiesSet();
    RedisAsyncConnection<byte[], byte[]> client = pool.getResource();
    assertNotNull(client);
    pool.returnResource(client);
View Full Code Here

    client.close();
  }

  @Test
  public void testReturnBrokenResource() {
    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxTotal(1);
    poolConfig.setMaxWaitMillis(1);
    this.pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort(), poolConfig);
    pool.afterPropertiesSet();
    RedisAsyncConnection<byte[], byte[]> client = pool.getResource();
    assertNotNull(client);
    pool.returnBrokenResource(client);
View Full Code Here

    client.ping();
  }

  @Test
  public void testGetResourcePoolExhausted() {
    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxTotal(1);
    poolConfig.setMaxWaitMillis(1);
    this.pool = new JredisPool(connectionSpec, poolConfig);
    JRedis client = pool.getResource();
    assertNotNull(client);
    try {
      pool.getResource();
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.