Skip to content

Commit

Permalink
jedis2.6以后直接调用close就行了,不用搞那么麻烦了.
Browse files Browse the repository at this point in the history
  • Loading branch information
yujiasun committed Jun 11, 2016
1 parent fd41ddc commit e3cd5ad
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.distributed.limit.redis;

import com.distributed.utils.JedisUtils;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
Expand Down Expand Up @@ -75,13 +74,9 @@ public boolean tryAccess(String key,LimitRule limitRule){
args.add(limitRule.getLockTime()+"");
count=Long.parseLong(jedis.eval(buildLuaScript(limitRule),keys,args)+"");
return count<=limitRule.getLimitCount();
} catch (JedisException e) {
log.error(e.getMessage(),e);
broken = JedisUtils.handleJedisException(jedisPool, e);
} finally {
JedisUtils.closeResource(jedisPool, jedis, broken);
if(jedis!=null)jedis.close();
}
return false;
}


Expand Down

0 comments on commit e3cd5ad

Please sign in to comment.