Package org.apache.uima.ducc.ws

Examples of org.apache.uima.ducc.ws.DuccDaemonsData


   
    JsonObject jsonResponse = new JsonObject();
    JsonArray data = new JsonArray();
    JsonArray row;
   
    DuccDaemonsData duccDaemonsData = DuccDaemonsData.getInstance();

    for(DaemonName daemonName : DuccDaemonRuntimeProperties.daemonNames) {
      row = new JsonArray();
      String status = "";
      String heartbeat = "*";
      String heartmax = "*";
      Properties properties = DuccDaemonRuntimeProperties.getInstance().get(daemonName);
      switch(daemonName) {
      case Webserver:
        status = DuccHandlerUtils.up();
        break;
      default:
        status = DuccHandlerUtils.unknown();
        if(daemonName.equals(DaemonName.Orchestrator)) {
          if(ComponentHelper.isLocked(IDuccEnv.DUCC_STATE_DIR,"orchestrator")) {
            String filename = ComponentHelper.getLockFileName(IDuccEnv.DUCC_STATE_DIR,"orchestrator");
            String hover = "title=\""+ComponentHelper.getLockFileNameWithPath(IDuccEnv.DUCC_STATE_DIR,"orchestrator")+"\"";
            String fileNameWithHover = "<span "+hover+" >"+filename+"</span>";
            status += ", "+DuccHandlerUtils.warn("warning: ")+fileNameWithHover+" found.";
          }
        }
        heartbeat = DuccDaemonsData.getInstance().getHeartbeat(daemonName);
        long timeout = getMillisMIA(daemonName)/1000;
        if(timeout > 0) {
          try {
            long overtime = timeout - Long.parseLong(heartbeat);
            if(overtime < 0) {
              status = DuccHandlerUtils.down();
              if(daemonName.equals(DaemonName.Orchestrator)) {
                if(ComponentHelper.isLocked(IDuccEnv.DUCC_STATE_DIR,"orchestrator")) {
                  String filename = ComponentHelper.getLockFileName(IDuccEnv.DUCC_STATE_DIR,"orchestrator");
                  String hover = "title=\""+ComponentHelper.getLockFileNameWithPath(IDuccEnv.DUCC_STATE_DIR,"orchestrator")+"\"";
                  String fileNameWithHover = "<span "+hover+" >"+filename+"</span>";
                  status += ", "+DuccHandlerUtils.warn("warning: ")+fileNameWithHover+" found.";
                }
              }
            }
            else {
              status = DuccHandlerUtils.up();
              if(daemonName.equals(DaemonName.Orchestrator)) {
                int jdCount = DuccData.getInstance().getLive().getJobDriverNodeCount();
                if(jdCount == 0) {
                  status = DuccHandlerUtils.up_provisional(", pending JD allocation");
                }
              }
            }
          }
          catch(Throwable t) {
          }
        }
        heartmax = DuccDaemonsData.getInstance().getMaxHeartbeat(daemonName);
        break;
      }
      // Status
      row.add(new JsonPrimitive(status));
      // Daemon Name
      String name = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyDaemonName,daemonName.toString());
      row.add(new JsonPrimitive(name));
      // Boot Time
      String boot = getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,""));
      row.add(new JsonPrimitive(boot));
      // Host IP
      String ip = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,"");
      row.add(new JsonPrimitive(ip));
      // Host Name
      String node = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeName,"");
      row.add(new JsonPrimitive(node));
      // PID
      String pid = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,"");
      row.add(new JsonPrimitive(pid));
      // Publication Size (last)
      Long pubSize = duccDaemonsData.getEventSize(daemonName);
      row.add(new JsonPrimitive(""+pubSize));
      // Publication Size (max)
      Long pubSizeMax = duccDaemonsData.getEventSizeMax(daemonName);
      row.add(new JsonPrimitive(""+pubSizeMax));
      // Heartbeat (last)
      row.add(new JsonPrimitive(""+heartbeat));
      // Heartbeat (max)
      row.add(new JsonPrimitive(""+heartmax));
View Full Code Here


  {
    String methodName = "handleServletClassicSystemDaemons";
    duccLogger.trace(methodName, jobid, messages.fetch("enter"));
    StringBuffer sb = new StringBuffer();
   
    DuccDaemonsData duccDaemonsData = DuccDaemonsData.getInstance();
    int counter = 0;
    for(DaemonName daemonName : DuccDaemonRuntimeProperties.daemonNames) {
      String status = "";
      String heartbeat = "*";
      String heartmax = "*";
      Properties properties = DuccDaemonRuntimeProperties.getInstance().get(daemonName);
      switch(daemonName) {
      case Webserver:
        status = DuccHandlerUtils.up();
        break;
      default:
        status = DuccHandlerUtils.unknown();
        if(daemonName.equals(DaemonName.Orchestrator)) {
          if(ComponentHelper.isLocked(IDuccEnv.DUCC_STATE_DIR,"orchestrator")) {
            String filename = ComponentHelper.getLockFileName(IDuccEnv.DUCC_STATE_DIR,"orchestrator");
            String hover = "title=\""+ComponentHelper.getLockFileNameWithPath(IDuccEnv.DUCC_STATE_DIR,"orchestrator")+"\"";
            String fileNameWithHover = "<span "+hover+" >"+filename+"</span>";
            status += ", "+DuccHandlerUtils.warn("warning: ")+fileNameWithHover+" found.";
          }
        }
        heartbeat = DuccDaemonsData.getInstance().getHeartbeat(daemonName);
        long timeout = getMillisMIA(daemonName)/1000;
        if(timeout > 0) {
          try {
            long overtime = timeout - Long.parseLong(heartbeat);
            if(overtime < 0) {
              status = DuccHandlerUtils.down();
              if(daemonName.equals(DaemonName.Orchestrator)) {
                if(ComponentHelper.isLocked(IDuccEnv.DUCC_STATE_DIR,"orchestrator")) {
                  String filename = ComponentHelper.getLockFileName(IDuccEnv.DUCC_STATE_DIR,"orchestrator");
                  String hover = "title=\""+ComponentHelper.getLockFileNameWithPath(IDuccEnv.DUCC_STATE_DIR,"orchestrator")+"\"";
                  String fileNameWithHover = "<span "+hover+" >"+filename+"</span>";
                  status += ", "+DuccHandlerUtils.warn("warning: ")+fileNameWithHover+" found.";
                }
              }
            }
            else {
              status = DuccHandlerUtils.up();
              if(daemonName.equals(DaemonName.Orchestrator)) {
                int jdCount = DuccData.getInstance().getLive().getJobDriverNodeCount();
                if(jdCount == 0) {
                  status = DuccHandlerUtils.up_provisional(", pending JD allocation");
                }
              }
            }
          }
          catch(Throwable t) {
          }
        }
        heartmax = DuccDaemonsData.getInstance().getMaxHeartbeat(daemonName);
        break;
      }
      // Status
      sb.append(trGet(counter));
      sb.append("<td>");
      sb.append(status);
      sb.append("</td>")
      // Daemon Name
      sb.append("<td>");
      sb.append(getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyDaemonName,daemonName.toString()));
      sb.append("</td>");
      // Boot Time
      sb.append("<td>");
      sb.append(getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,"")));
      sb.append("</td>");
      // Host IP
      sb.append("<td>");
      sb.append(getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,""));
      sb.append("</td>")
      // Host Name
      sb.append("<td>");
      sb.append(getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeName,""));
      sb.append("</td>");
      // PID
      sb.append("<td>");
      sb.append(getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,""));
      sb.append("</td>");
      // Publication Size (last)
      sb.append("<td align=\"right\">");
      Long pubSize = duccDaemonsData.getEventSize(daemonName);
      sb.append(""+pubSize);
      sb.append("</td>")
      // Publication Size (max)
      sb.append("<td align=\"right\">");
      Long pubSizeMax = duccDaemonsData.getEventSizeMax(daemonName);
      sb.append(""+pubSizeMax);
      sb.append("</td>")
      // Heartbeat (last)
      sb.append("<td align=\"right\">");
      sb.append(heartbeat);
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.ws.DuccDaemonsData

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.