Package org.apache.commons.pool2.proxy

Examples of org.apache.commons.pool2.proxy.BaseProxyHandler


  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

  shards.add(new JedisShardInfo(new URI(
    "redis://:foobared@localhost:6380")));
  shards.add(new JedisShardInfo(new URI(
    "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

  assertEquals("bar", jedis.get("foo"));
    }

    @Test
    public void returnResourceShouldResetState() throws URISyntaxException {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);

  List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
  shards.add(new JedisShardInfo(new URI(
    "redis://:foobared@localhost:6380")));
  shards.add(new JedisShardInfo(new URI(
View Full Code Here

  pool.destroy();
    }

    @Test
    public void checkResourceIsCloseable() throws URISyntaxException {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);

  List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
  shards.add(new JedisShardInfo(new URI(
    "redis://:foobared@localhost:6380")));
  shards.add(new JedisShardInfo(new URI(
View Full Code Here

  this(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, null,
    Protocol.DEFAULT_DATABASE);
    }

    public JedisSentinelPool(String masterName, Set<String> sentinels) {
  this(masterName, sentinels, new GenericObjectPoolConfig(),
    Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE);
    }
View Full Code Here

    Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE);
    }

    public JedisSentinelPool(String masterName, Set<String> sentinels,
      String password) {
  this(masterName, sentinels, new GenericObjectPoolConfig(),
    Protocol.DEFAULT_TIMEOUT, password);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.pool2.proxy.BaseProxyHandler

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.