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

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


  pool.destroy();
    }

    @Test
    public void checkCloseableConnections() throws Exception {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();

  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);
  Jedis jedis = pool.getResource();
  jedis.auth("foobared");
View Full Code Here


    }

    @Test
    public void ensureSafeTwiceFailover() throws InterruptedException {
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    new GenericObjectPoolConfig(), 1000, "foobared", 2);

  forceFailover(pool);
  // after failover sentinel needs a bit of time to stabilize before a new
  // failover
  Thread.sleep(100);
View Full Code Here

  // you can test failover as much as possible
    }

    @Test
    public void returnResourceShouldResetState() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);

  Jedis jedis = pool.getResource();
  Jedis jedis2 = null;
View Full Code Here

  }
    }

    @Test
    public void checkResourceIsCloseable() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);

  Jedis jedis = pool.getResource();
  try {
View Full Code Here

  }
    }

    @Test
    public void returnResourceWithNullResource() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);

  Jedis nullJedis = null;
  pool.returnResource(nullJedis);
View Full Code Here

  pool.destroy();
    }

    @Test
    public void returnBrokenResourceWithNullResource() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);

  Jedis nullJedis = null;
  pool.returnBrokenResource(nullJedis);
View Full Code Here

  long elapsed = System.currentTimeMillis() - t;
  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
    }

    private static void withPool() throws Exception {
  final JedisPool pool = new JedisPool(new GenericObjectPoolConfig(),
    hnp.getHost(), hnp.getPort(), 2000, "foobared");
  List<Thread> tds = new ArrayList<Thread>();

  final AtomicInteger ind = new AtomicInteger();
  for (int i = 0; i < 50; i++) {
View Full Code Here

  this(poolConfig, host, Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT,
    null, Protocol.DEFAULT_DATABASE, null);
    }

    public JedisPool(String host, int port) {
  this(new GenericObjectPoolConfig(), host, port,
    Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE, null);
    }
View Full Code Here

    database = dbIndex.intValue();
      }
      this.internalPool = new GenericObjectPool<Jedis>(
        new JedisFactory(h, port, Protocol.DEFAULT_TIMEOUT,
          password, database, null),
        new GenericObjectPoolConfig());
  } else {
      this.internalPool = new GenericObjectPool<Jedis>(new JedisFactory(
        host, Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT,
        null, Protocol.DEFAULT_DATABASE, null),
        new GenericObjectPoolConfig());
  }
    }
View Full Code Here

        new GenericObjectPoolConfig());
  }
    }

    public JedisPool(final URI uri) {
  this(new GenericObjectPoolConfig(), uri, Protocol.DEFAULT_TIMEOUT);
    }
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.