コード例 #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
  private void extractValues(String elementName, XmlPullParser pullParser)
      throws IOException, XmlPullParserException {

    this.repeatGap = REPEAT_GAP_DEFAULT * displayModel.getScaleFactor();
    this.repeatStart = REPEAT_START_DEFAULT * displayModel.getScaleFactor();

    for (int i = 0; i < pullParser.getAttributeCount(); ++i) {
      String name = pullParser.getAttributeName(i);
      String value = pullParser.getAttributeValue(i);

      if (SRC.equals(name)) {
        this.src = value;
      } else if (DISPLAY.equals(name)) {
        this.display = Display.fromString(value);
      } else if (DY.equals(name)) {
        this.dy = Float.parseFloat(value) * displayModel.getScaleFactor();
      } else if (ALIGN_CENTER.equals(name)) {
        this.alignCenter = Boolean.parseBoolean(value);
      } else if (CAT.equals(name)) {
        this.category = value;
      } else if (PRIORITY.equals(name)) {
        this.priority = Integer.parseInt(value);
      } else if (REPEAT.equals(name)) {
        this.repeat = Boolean.parseBoolean(value);
      } else if (REPEAT_GAP.equals(name)) {
        this.repeatGap = Float.parseFloat(value) * displayModel.getScaleFactor();
      } else if (REPEAT_START.equals(name)) {
        this.repeatStart = Float.parseFloat(value) * displayModel.getScaleFactor();
      } else if (ROTATE.equals(name)) {
        this.rotate = Boolean.parseBoolean(value);
      } else if (SYMBOL_HEIGHT.equals(name)) {
        this.height = XmlUtils.parseNonNegativeInteger(name, value) * displayModel.getScaleFactor();
      } else if (SYMBOL_PERCENT.equals(name)) {
        this.percent = XmlUtils.parseNonNegativeInteger(name, value);
      } else if (SYMBOL_SCALING.equals(name)) {
        this.scaling = fromValue(value);
      } else if (SYMBOL_WIDTH.equals(name)) {
        this.width = XmlUtils.parseNonNegativeInteger(name, value) * displayModel.getScaleFactor();
      } else {
        throw XmlUtils.createXmlPullParserException(elementName, name, value, i);
      }
    }
  }
コード例 #3
0
 public boolean hasChangedHigherThan(PRIORITY priority) {
   return highestPriorityChanged != null && highestPriorityChanged.compareTo(priority) < 0;
 }