}
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);
}
}