Package org.apache.commons.pool2.impl

Examples of org.apache.commons.pool2.impl.GenericObjectPoolConfig


   *
   * @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

    }
  }

  @Test
  public void testGetResourceValidate() {
    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setTestOnBorrow(true);
    this.pool = new JredisPool(connectionSpec, poolConfig);
    JRedis client = pool.getResource();
    assertNotNull(client);
  }
View Full Code Here

  }

  @Test
  public void testReturnResource() throws RedisException {

    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMaxTotal(1);
    poolConfig.setMaxWaitMillis(1);
    this.pool = new JredisPool(connectionSpec);
    JRedis client = pool.getResource();
    assertNotNull(client);
    pool.returnResource(client);
    assertNotNull(pool.getResource());
View Full Code Here

TOP

Related Classes of org.apache.commons.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.