コード例 #1
0
    public void process(WatchedEvent event) {
      LOGGER.debug(
          "Watcher fired on path: "
              + event.getPath()
              + " state: "
              + event.getState()
              + " type "
              + event.getType());

      latchIfNoChange.countDown();

      // ignore any children except valid children for a queue
      if (keyHandler.hasValidName(ZkUtils.getPathEnd(event.getPath()))) {

        if (highestPriorityChanged == null) {
          highestPriorityChanged = keyHandler.getPriority(event.getPath());
        } else {
          synchronized (highestPriorityChanged) {
            PRIORITY changedPriority = keyHandler.getPriority(event.getPath());
            if (changedPriority != null && changedPriority.compareTo(highestPriorityChanged) < 0) {
              highestPriorityChanged = changedPriority;
            }
          }
        }
      }
    }
コード例 #2
0
 public boolean hasChangedHigherThan(PRIORITY priority) {
   return highestPriorityChanged != null && highestPriorityChanged.compareTo(priority) < 0;
 }