Package org.apache.uima.aae.monitor.statistics

Examples of org.apache.uima.aae.monitor.statistics.LongNumericStatistic


  public Statistics getStatistics(String aComponentName) {
    return (Statistics) componentStatistics.get(aComponentName);
  }

  public synchronized void resetCountingStatistic(String aComponent, String aStatisticName) {
    LongNumericStatistic countStat = getLongNumericStatistic(aComponent, aStatisticName);
    if (countStat != null) {
      synchronized (countStat) {
        countStat.reset();
      }
    }
  }
View Full Code Here


      Statistics stats = getStatistics(aComponentName);
      if (stats.containsKey(aStatisticName)) {
        return (Statistic) stats.get(aStatisticName);
      }
    } else {
      LongNumericStatistic countStat = new LongNumericStatistic(aStatisticName);
      addStatistic(aComponentName, countStat);
      return (Statistic) countStat;
    }

    return null;
View Full Code Here

  }

  public void initialize() throws AsynchAEException {
    Statistic statistic = null;
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessCount)) == null) {
      statistic = new LongNumericStatistic(Monitor.ProcessCount);
      getMonitor().addStatistic("", statistic);
    }
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessErrorCount)) == null) {
      statistic = new LongNumericStatistic(Monitor.ProcessErrorCount);
      getMonitor().addStatistic("", statistic);
    }
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessErrorRetryCount)) == null) {
      statistic = new LongNumericStatistic(Monitor.ProcessErrorRetryCount);
      getMonitor().addStatistic("", statistic);
    }
  }
View Full Code Here

  }

  private void initializeServiceStats() {
    Statistic statistic = null;
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalDeserializeTime)) == null) {
      statistic = new LongNumericStatistic(Monitor.TotalDeserializeTime);
      getMonitor().addStatistic("", statistic);
    }
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalSerializeTime)) == null) {
      statistic = new LongNumericStatistic(Monitor.TotalSerializeTime);
      getMonitor().addStatistic("", statistic);
    }
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.IdleTime)) == null) {
      statistic = new LongNumericStatistic(Monitor.IdleTime);
      getMonitor().addStatistic("", statistic);
    }
    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessCount)) == null) {
      statistic = new LongNumericStatistic(Monitor.ProcessCount);
      getMonitor().addStatistic("", statistic);
    }
    if (this instanceof PrimitiveAnalysisEngineController) {
      if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessErrorCount)) == null) {
        statistic = new LongNumericStatistic(Monitor.ProcessErrorCount);
        getMonitor().addStatistic("", statistic);
      }
      if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalProcessErrorCount)) == null) {
        statistic = new LongNumericStatistic(Monitor.TotalProcessErrorCount);
        getMonitor().addStatistic("", statistic);
      }
      if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalAEProcessTime)) == null) {
        statistic = new LongNumericStatistic(Monitor.TotalAEProcessTime);
        getMonitor().addStatistic("", statistic);
      }
    }
  }
View Full Code Here

  /**
   * Clears controller statistics.
   *
   */
  protected void clearStats() {
    LongNumericStatistic statistic;
    Statistics stats = getMonitor().getStatistics("");
    Set set = stats.entrySet();
    for (Iterator it = set.iterator(); it.hasNext();) {
      Map.Entry entry = (Map.Entry) it.next();
      if (entry != null && entry.getValue() != null
View Full Code Here

  /**
   * Returns a copy of the controller statistics.
   *
   */
  public Map getStats() {
    LongNumericStatistic statistic;
    float totalIdleTime = 0;
    long numberCASesProcessed = 0;
    float totalDeserializeTime = 0;
    float totalSerializeTime = 0;
    HashMap map = new HashMap();

    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.IdleTime)) != null) {
      if (statistic.getValue() > 0) {
        totalIdleTime = (float) statistic.getValue() / (float) 1000000; // get millis
      }
    }
    map.put(Monitor.IdleTime, totalIdleTime);

    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.ProcessCount)) != null) {
      numberCASesProcessed = statistic.getValue();
    }
    map.put(Monitor.ProcessCount, numberCASesProcessed);

    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalDeserializeTime)) != null) {
      if (statistic.getValue() > 0) {
        totalDeserializeTime = (float) statistic.getValue() / (float) 1000000; // get millis
      }
    }
    map.put(Monitor.TotalDeserializeTime, totalDeserializeTime);

    if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalSerializeTime)) != null) {
      if (statistic.getValue() > 0) {
        totalSerializeTime = (float) statistic.getValue() / (float) 1000000; // get millis
      }
    }
    map.put(Monitor.TotalSerializeTime, totalSerializeTime);
    if (this instanceof PrimitiveAnalysisEngineController) {
      float totalAEProcessTime = 0;
      if ((statistic = getMonitor().getLongNumericStatistic("", Monitor.TotalAEProcessTime)) != null) {
        if (statistic.getValue() > 0) {
          totalAEProcessTime = (float) statistic.getValue() / (float) 1000000; // get millis
        }
      }
      map.put(Monitor.TotalAEProcessTime, totalAEProcessTime);
    }
    return map;
View Full Code Here

    Threshold threshold = getThreshold(aThresholdToCheck, endpoint);
    if (threshold != null) {
      Monitor monitor = controller.getMonitor();
      Statistic statistic = null;
      if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null) {
        statistic = new LongNumericStatistic(aThresholdToCheck);
        monitor.addStatistic(endpoint, statistic);
      }
      if (statistic instanceof LongNumericStatistic) {
        ((LongNumericStatistic) statistic).increment();
        if (threshold.exceeded(((LongNumericStatistic) statistic).getValue())) {
View Full Code Here

    if (aThreshold != null) {
      Monitor monitor = controller.getMonitor();
      Statistic statistic = null;

      if ((statistic = monitor.getStatistic(endpoint, aThresholdToCheck)) == null) {
        statistic = new LongNumericStatistic(aThresholdToCheck);
        monitor.addStatistic(endpoint, statistic);
      }
      if (Monitor.GetMetaErrorRetryCount.equals(aThresholdToCheck)
              || Monitor.ProcessErrorRetryCount.equals(aThresholdToCheck)) {
        return aThreshold.maxRetriesExceeded(((LongNumericStatistic) statistic).getValue());
View Full Code Here

  protected synchronized void incrementStatistic(Monitor aMonitor, String aComponentName,
          String aStatistic) {
    Statistic statistic = aMonitor.getStatistic(aComponentName, aStatistic);
    if (statistic == null) {
      statistic = new LongNumericStatistic(aStatistic);
      aMonitor.addStatistic(aComponentName, statistic);
    }

    if (statistic instanceof LongNumericStatistic) {
      ((LongNumericStatistic) statistic).increment();
View Full Code Here

    return false;
  }

  protected synchronized boolean exceedsThresholdWithinWindow(Monitor aMonitor, String aStat,
          String aComponent, Threshold aThreshold) {
    LongNumericStatistic currentErrorCountStat = aMonitor
            .getLongNumericStatistic(aComponent, aStat);
    LongNumericStatistic currentProcessCountStat = aMonitor.getLongNumericStatistic(aComponent,
            Monitor.ProcessCount);
    long numberOfErrors = currentErrorCountStat.getValue();
    // Check if threshold exceeded
    if (numberOfErrors > 0 && aThreshold.getThreshold() > 0
            && numberOfErrors % aThreshold.getThreshold() == 0) {
      return true;
    }
    // Check if reached end of window. If so, begin counting against a new window
    if (aThreshold.getThreshold() > 0 && aThreshold.getWindow() > 0
            && currentProcessCountStat.getValue() % aThreshold.getWindow() == 0) {
      aMonitor.resetCountingStatistic(aComponent, aStat);
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.monitor.statistics.LongNumericStatistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.