示例#1
0
 /** Remove the event and save the response into the other path. */
 public byte[] remove(QueueEvent event) throws KeeperException, InterruptedException {
   TimerContext time = stats.time(dir + "_remove_event");
   try {
     String path = event.getId();
     String responsePath = dir + "/" + response_prefix + path.substring(path.lastIndexOf("-") + 1);
     if (zookeeper.exists(responsePath, true)) {
       zookeeper.setData(responsePath, event.getBytes(), true);
     } else {
       LOG.info(
           "Response ZK path: "
               + responsePath
               + " doesn't exist."
               + "  Requestor may have disconnected from ZooKeeper");
     }
     byte[] data = zookeeper.getData(path, null, null, true);
     zookeeper.delete(path, -1, true);
     return data;
   } finally {
     time.stop();
   }
 }