public void run() {
    try {
      while (true) {

        Thread.sleep(frequency);
        synchronized (factory) {
          synchronized (owlModel) {
            MonitoringMain.display("\t" + calculateSLAParameter());
          }
        }
      }
    } catch (Exception x) {
      x.printStackTrace();
    }
  }
示例#2
0
  public void removeForwardReferences() {
    KnowledgeBase kb = this.getKnowledgeBase();
    Slot branches = kb.getSlot("branches");
    Slot followed_by = kb.getSlot("followed_by");
    // logger.debug("Slot "+branches.getName());
    // logger.debug("Slot "+followed_by.getName());
    Slot label = kb.getSlot("label");
    Collection steps = getOwnSlotValues(kb.getSlot("steps"));
    for (Iterator iterater = steps.iterator(); iterater.hasNext(); ) {
      Instance step = (Instance) iterater.next();
      // logger.debug("removeForwardReferences: node ="+step.getOwnSlotValue(label));
      /*for (Iterator slots=step.getOwnSlots().iterator(); slots.hasNext();){
      	logger.debug("has slot "+((Slot)slots.next()).getName());
      }*/
      try {
        if (step.hasOwnSlot(branches)) {
          /*logger.debug("removeForwardReferences: "+ step.getOwnSlotValue(label)+
          " has branches"); */
          step.setOwnSlotValues(branches, new ArrayList());
        } else if (step.hasOwnSlot(followed_by)) {
          /* logger.debug("removeForwardReferences: "+ step.getOwnSlotValue(label)+
          " has followed_by value "+step.getOwnSlotValue(followed_by));*/
          step.setOwnSlotValue(followed_by, null);
        } else
          logger.error(
              "removeForwardReferences: "
                  + step.getOwnSlotValue(label)
                  + "has no followed_by or branches slot");
      } catch (Exception e) {

        logger.error(
            "Exception making " + step.getOwnSlotValue(label) + " null, Message: " + e.getMessage(),
            e);
      }
    }
  }