Examples of JedisPool


Examples of redis.clients.jedis.JedisPool

    }
    return success;
  }

  private JedisPool createPool(String url) {
    JedisPool pool = null;
    if (!StringUtils.isEmpty(url)) {
      try {
        URI uri = URI.create(url);
        if (uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("redis")) {
          int database = Protocol.DEFAULT_DATABASE;
          String password = null;
          if (uri.getUserInfo() != null) {
            password = uri.getUserInfo().split(":", 2)[1];
          }
          if (uri.getPath().indexOf('/') > -1) {
            database = Integer.parseInt(uri.getPath().split("/", 2)[1]);
          }
          pool = new JedisPool(new GenericObjectPoolConfig(), uri.getHost(), uri.getPort(), Protocol.DEFAULT_TIMEOUT, password, database);
        } else {
          pool = new JedisPool(url);
        }
      } catch (JedisException e) {
        log.error("failed to create a Redis pool!", e);
      }
    }
View Full Code Here

Examples of redis.clients.jedis.JedisPool

        shardInfo.setTimeout(timeout);
      }
    }

    if (usePool) {
      pool = new JedisPool(poolConfig, shardInfo.getHost(), shardInfo.getPort(), shardInfo.getTimeout(),
          shardInfo.getPassword());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.