|
@ -41,14 +41,16 @@ public class RedisThread implements Runnable {
|
|
|
poolConfig.setMaxTotal(8);
|
|
|
poolConfig.setMaxWaitMillis(-1);
|
|
|
poolConfig.setMinIdle(1);
|
|
|
JedisPool pool = new JedisPool(poolConfig,host,port,100000,password);
|
|
|
JedisPool pool = null;
|
|
|
if(StringUtils.isNotBlank(password)){
|
|
|
pool = new JedisPool(poolConfig,host,port,100000,password);
|
|
|
}else {
|
|
|
pool = new JedisPool(poolConfig,host,port,100000);
|
|
|
}
|
|
|
|
|
|
while (true){
|
|
|
try {
|
|
|
Jedis jedis = pool.getResource();
|
|
|
// if(StringUtils.isNotBlank(password)){
|
|
|
// jedis.auth(password);
|
|
|
// }
|
|
|
String message = jedis.rpop(key);
|
|
|
if(StringUtils.isEmpty(message)){
|
|
|
Thread.sleep(1000L);//如果没有读取到记录,等待1秒
|