Exemple #1
0
 public boolean validateObject(final Object obj) {
   try {
     ShardedJedis jedis = (ShardedJedis) obj;
     for (Jedis shard : jedis.getAllShards()) {
       if (!shard.ping().equals("PONG")) {
         return false;
       }
     }
     return true;
   } catch (Exception ex) {
     return false;
   }
 }
Exemple #2
0
    public void destroyObject(final Object obj) throws Exception {
      if ((obj != null) && (obj instanceof ShardedJedis)) {
        ShardedJedis shardedJedis = (ShardedJedis) obj;
        for (Jedis jedis : shardedJedis.getAllShards()) {
          try {
            try {
              jedis.quit();
            } catch (Exception e) {

            }
            jedis.disconnect();
          } catch (Exception e) {

          }
        }
      }
    }