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

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


    }

    @Test
    public void checkConnections() {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
View Full Code Here


    }

    @Test
    public void checkCloseableConnections() throws Exception {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.close();
View Full Code Here

    }

    @Test
    public void checkConnectionWithDefaultPort() {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
View Full Code Here

    }

    @Test
    public void checkJedisIsReusedWhenReturned() {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "0");
  pool.returnResource(jedis);

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

    }

    @Test
    public void checkPoolRepairedWhenJedisIsBroken() {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.disconnect();
  pool.returnBrokenResource(jedis);

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

  pool.destroy();
    }

    @Test(expected = JedisConnectionException.class)
    public void checkPoolOverflow() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);

  ShardedJedisPool pool = new ShardedJedisPool(config, shards);

  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "0");
View Full Code Here

  newJedis.incr("foo");
    }

    @Test
    public void shouldNotShareInstances() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(2);

  ShardedJedisPool pool = new ShardedJedisPool(config, shards);

  ShardedJedis j1 = pool.getResource();
  ShardedJedis j2 = pool.getResource();
View Full Code Here

    }

    @Test
    public void checkFailedJedisServer() {
  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
    }
View Full Code Here

  pool.destroy();
    }

    @Test
    public void shouldReturnActiveShardsWhenOneGoesOffline() {
  GenericObjectPoolConfig redisConfig = new GenericObjectPoolConfig();
  redisConfig.setTestOnBorrow(false);
  ShardedJedisPool pool = new ShardedJedisPool(redisConfig, shards);
  ShardedJedis jedis = pool.getResource();
  // fill the shards
  for (int i = 0; i < 1000; i++) {
      jedis.set("a-test-" + i, "0");
View Full Code Here

  List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
  shards.add(new JedisShardInfo("redis://:foobared@localhost:6380"));
  shards.add(new JedisShardInfo("redis://:foobared@localhost:6379"));

  GenericObjectPoolConfig redisConfig = new GenericObjectPoolConfig();
  ShardedJedisPool pool = new ShardedJedisPool(redisConfig, shards);

  Jedis[] jedises = pool.getResource().getAllShards()
    .toArray(new Jedis[2]);
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.