我们应该在什么时候使用这种方法。在 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);
}