|
@@ -43,11 +43,13 @@ public class JedisUtil implements Serializable {
|
|
config.setTestOnBorrow(Boolean.parseBoolean(jp.getPool().getTestOnBorrow()));
|
|
config.setTestOnBorrow(Boolean.parseBoolean(jp.getPool().getTestOnBorrow()));
|
|
String redisIp = jp.getHost();
|
|
String redisIp = jp.getHost();
|
|
int port = Integer.parseInt(jp.getPort());
|
|
int port = Integer.parseInt(jp.getPort());
|
|
- jedisPool = new JedisPool(config, redisIp, port, 10000);
|
|
|
|
|
|
+ String password = jp.getPassword();
|
|
|
|
+ int database = jp.getDatabase();
|
|
|
|
+ jedisPool = new JedisPool(config, redisIp, port, 10000, password, database);
|
|
|
|
|
|
- logger.info("redis连接成功: {}:{}, ", redisIp, port);
|
|
|
|
|
|
+ logger.info("redis连接成功: {}:{}, 连接池:{}", redisIp, port, jedisPool);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- logger.error("init RedisUtils is error");
|
|
|
|
|
|
+ logger.error("init RedisUtils is error", e);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -926,6 +928,7 @@ public class JedisUtil implements Serializable {
|
|
public static Jedis getResource() throws JedisException {
|
|
public static Jedis getResource() throws JedisException {
|
|
Jedis jedis = null;
|
|
Jedis jedis = null;
|
|
try {
|
|
try {
|
|
|
|
+ logger.debug("jedisPool.{}", jedisPool);
|
|
jedis = jedisPool.getResource();
|
|
jedis = jedisPool.getResource();
|
|
// logger.debug("getResource.", jedis);
|
|
// logger.debug("getResource.", jedis);
|
|
} catch (JedisException e) {
|
|
} catch (JedisException e) {
|