Exemplo n.º 1
0
  public void handleQuery(Query query) throws IOException {
    log.info("Reporting query statatistics");
    bout.write(query.getIdentifier() + ";");

    MonitoringService m = MonitoringUtil.getMonitoringService();
    try {
      int total = 0;
      for (Endpoint e : endpoints) {
        try {
          MonitoringInformation mInfo = m.getMonitoringInformation(e);
          int requestCount = mInfo != null ? mInfo.getNumberOfRequests() : 0;

          total += requestCount;

          log.info("## " + e.getId() + " => " + requestCount + " requests");
          bout.write(requestCount + ";");
        } catch (Exception ex) {
          log.warn("Exception (" + ex.getClass() + "):" + ex.getMessage());
          bout.write("-1;");
        }
      }
      bout.write(total + ";");
      bout.write("\r\n");
      bout.flush();
    } finally {
      m.resetMonitoringInformation();
    }
  }
Exemplo n.º 2
0
 public FedXMonitoringReport(List<Endpoint> endpoints) throws IOException {
   this.endpoints = endpoints;
   bout = new BufferedWriter(new FileWriter("result/fedx_stats.csv"));
   bout.write("query;");
   for (Endpoint e : endpoints) bout.write(e.getId() + ";");
   bout.write("total;");
   bout.write("\r\n");
 }