当我们应该使用这种方法.在JedisConnectionException,JedisDataException或任何JedisException.对于Jedis来说,我的知识没有很好的API文档.
try { Jedis jedis = JedisFactory.getInstance(); Pipeline pipe = jedis.pipelined(); Response<Set<Tuple>> idWithscore = pipe.zrangeWithscores(cachekey,from,to); **// some statement which may cause some other exception** Response<String> val = pipe.get(somekey); pipe.exec(); pipe.sync(); }catch (JedisConnectionException e) { JedisFactory.returnBrokenResource(jedis); }catch(Exception e){ **// What API I should use here?,how to find whether to use returnBrokenResource(jedis) or returnResource(jedis)** }finally{ JedisFactory.returnResource(jedis); }