Package org.apache.uima.ducc.ws

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


    long memSwap = 0;
    long alienPids = 0;
    long sharesTotal = 0;
    long sharesInuse = 0;
    while(iterator.hasNext()) {
      MachineInfo machineInfo = iterator.next();
      try {
        memTotal += Long.parseLong(machineInfo.getMemTotal());
      }
      catch(Exception e) {};
      try {
        memSwap += Long.parseLong(machineInfo.getMemSwap());
      }
      catch(Exception e) {};
      try {
        List<ProcessInfo> alienPidsList = machineInfo.getAlienPids();
        if(alienPidsList != null) {
          alienPids += alienPidsList.size();
        }
      }
      catch(Exception e) {};
      try {
        sharesTotal += Long.parseLong(machineInfo.getSharesTotal());
      }
      catch(Exception e) {};
      try {
        sharesInuse += Long.parseLong(machineInfo.getSharesInuse());
      }
      catch(Exception e) {};
    }
    // pass 2
    iterator = sortedMachines.keySet().iterator();
   
    sb.append("[");
   
    sb.append(quote("Total"));
    sb.append(",");
    sb.append(quote(""));
    sb.append(",");
    sb.append(quote(""));
    sb.append(",");
    sb.append(quote(""+memTotal));
    sb.append(",");
    sb.append(quote(""+memSwap));
    sb.append(",");
    sb.append(quote(""+alienPids));
    sb.append(",");
    sb.append(quote(""+sharesTotal));
    sb.append(",");
    sb.append(quote(""+sharesInuse));
    sb.append(",");
    sb.append(quote(""));
   
    sb.append("]");
   
    while(iterator.hasNext()) {
      sb.append(",");
      sb.append("[");
     
      MachineInfo machineInfo = iterator.next();
      sb.append(quote(machineInfo.getStatus()));
      sb.append(",");
      sb.append(quote(machineInfo.getIp()));
      sb.append(",");
      sb.append(quote(machineInfo.getName()));
      sb.append(",");
      sb.append(quote(machineInfo.getMemTotal()));
      sb.append(",");
      sb.append(quote(machineInfo.getMemSwap()));
      sb.append(",");
      List<ProcessInfo> alienPidsList = machineInfo.getAlienPids();
      String alienPidsDisplay = "";
      if(alienPidsList != null) {
        int size = alienPidsList.size();
        if(size > 0) {
          StringBuffer aliens = new StringBuffer();
          for( ProcessInfo processInfo : alienPidsList ) {
            String pid = processInfo.getPid();
            String uid = processInfo.getUid();
            aliens.append(pid+":"+uid+" ");
          }
          String entry = "<span title=\\\""+aliens.toString().trim()+"\\\">"+size+"</span>";
          alienPidsDisplay = entry;
        }
        else {
         
          alienPidsDisplay = ""+size;
        }
      }
      sb.append(quote(alienPidsDisplay));
      sb.append(",");
      sb.append(quote(machineInfo.getSharesTotal()));
      sb.append(",");
      sb.append(quote(machineInfo.getSharesInuse()));
      sb.append(",");
      sb.append(quote(machineInfo.getElapsed()));
     
      sb.append("]");
    }
   
    sb.append(" ]");
View Full Code Here


      duccLogger.trace(methodName, jobid, "== show: "+cookie);
      ConcurrentSkipListMap<String,MachineInfo> machines = DuccMachinesData.getInstance().getMachines();
      Iterator<String> iterator = machines.keySet().iterator();
      while(iterator.hasNext()) {
        String key = iterator.next();
        MachineInfo machineInfo = machines.get(key);
        Properties properties = DuccDaemonRuntimeProperties.getInstance().getAgent(machineInfo.getName());
        if(first) {
          first = false;
        }
        else {
          sb.append(",");
        }
        sb.append("[");
        // Status
        String status;
        String machineStatus = machineInfo.getStatus();
        if(machineStatus.equals("down")) {
          //status.append("<span class=\"health_red\""+">");
          status = machineStatus;
          //status.append("</span>");
        }
        else if(machineStatus.equals("up")) {
          //status.append("<span class=\"health_green\""+">");
          status = machineStatus;
          //status.append("</span>");
        }
        else {
          status = "unknown";
        }
        sb.append(quote(status));
        // Daemon Name
        sb.append(",");
        String daemonName = "Agent";
        sb.append(quote(daemonName));
        // Boot Time
        sb.append(",");
        String bootTime = getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,""));
        sb.append(quote(bootTime));
        // Host IP
        sb.append(",");
        String hostIP = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,"");
        sb.append(quote(hostIP));
        // Host Name
        sb.append(",");
        String hostName = machineInfo.getName();
        sb.append(quote(hostName));
        // PID
        sb.append(",");
        String pid = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,"");
        sb.append(quote(pid));
        // Publication Size (last)
        sb.append(",");
        String publicationSizeLast = machineInfo.getPublicationSizeLast();
        sb.append(quote(publicationSizeLast));
        // Publication Size (max)
        sb.append(",");
        String publicationSizeMax = machineInfo.getPublicationSizeMax();
        sb.append(quote(publicationSizeMax));
        // Heartbeat (last)
        sb.append(",");
        String heartbeatLast = machineInfo.getHeartbeatLast();
        sb.append(quote(heartbeatLast));
        // Heartbeat (max)
        sb.append(",");
        String fmtHeartbeatMax = "";
        long heartbeatMax = machineInfo.getHeartbeatMax();
        if(heartbeatMax > 0) {
          fmtHeartbeatMax += heartbeatMax;
        }
        sb.append(quote(fmtHeartbeatMax));
        // Heartbeat (max) TOD
        sb.append(",");
        String fmtHeartbeatMaxTOD = "";
        long heartbeatMaxTOD = machineInfo.getHeartbeatMaxTOD();
        if(heartbeatMaxTOD > 0) {
          fmtHeartbeatMaxTOD = TimeStamp.simpleFormat(""+heartbeatMaxTOD);
          try {
            fmtHeartbeatMaxTOD = getTimeStamp(DuccCookies.getDateStyle(request),fmtHeartbeatMaxTOD);
          }
View Full Code Here

      ConcurrentSkipListMap<String,MachineInfo> machines = DuccMachinesData.getInstance().getMachines();
      Iterator<String> iterator = machines.keySet().iterator();
      while(iterator.hasNext()) {
        row = new JsonArray();
        String key = iterator.next();
        MachineInfo machineInfo = machines.get(key);
        Properties properties = DuccDaemonRuntimeProperties.getInstance().getAgent(machineInfo.getName());
        // Status
        StringBuffer status = new StringBuffer();
        String machineStatus = machineInfo.getStatus();
        if(machineStatus.equals("down")) {
          //status.append("<span class=\"health_red\""+">");
          status.append(DuccHandlerUtils.down());
          //status.append("</span>");
        }
        else if(machineStatus.equals("up")) {
          //status.append("<span class=\"health_green\""+">");
          status.append(DuccHandlerUtils.up());
          //status.append("</span>");
        }
        else {
          status.append(DuccHandlerUtils.unknown());
        }
        row.add(new JsonPrimitive(status.toString()));
        // Daemon Name
        String daemonName = "Agent";
        row.add(new JsonPrimitive(daemonName));
        // Boot Time
        String bootTime = getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,""));
        row.add(new JsonPrimitive(bootTime));
        // Host IP
        String hostIP = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,"");
        row.add(new JsonPrimitive(hostIP));
        // Host Name
        String hostName = machineInfo.getName();
        row.add(new JsonPrimitive(hostName));
        // PID
        String pid = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,"");
        row.add(new JsonPrimitive(pid));
        // Publication Size (last)
        String publicationSizeLast = machineInfo.getPublicationSizeLast();
        row.add(new JsonPrimitive(publicationSizeLast));
        // Publication Size (max)
        String publicationSizeMax = machineInfo.getPublicationSizeMax();
        row.add(new JsonPrimitive(publicationSizeMax));
        // Heartbeat (last)
        String heartbeatLast = machineInfo.getHeartbeatLast();
        row.add(new JsonPrimitive(heartbeatLast))
        // Heartbeat (max)
        long heartbeatMax = machineInfo.getHeartbeatMax();
        if(heartbeatMax > 0) {
          row.add(new JsonPrimitive(heartbeatMax))
        }
        else {
          row.add(new JsonPrimitive(""));
        }
        // Heartbeat (max) TOD
        String fmtHeartbeatMaxTOD = "";
        long heartbeatMaxTOD = machineInfo.getHeartbeatMaxTOD();
        if(heartbeatMaxTOD > 0) {
          fmtHeartbeatMaxTOD = TimeStamp.simpleFormat(""+heartbeatMaxTOD);
          try {
            fmtHeartbeatMaxTOD = getTimeStamp(DuccCookies.getDateStyle(request),fmtHeartbeatMaxTOD);
          }
View Full Code Here

     
      ConcurrentSkipListMap<String,MachineInfo> machines = DuccMachinesData.getInstance().getMachines();
      Iterator<String> iterator = machines.keySet().iterator();
      while(iterator.hasNext()) {
        String key = iterator.next();
        MachineInfo machineInfo = machines.get(key);
        Properties properties = DuccDaemonRuntimeProperties.getInstance().getAgent(machineInfo.getName());
        sb.append(trGet(counter));
        // Status
        StringBuffer status = new StringBuffer();
        String machineStatus = machineInfo.getStatus();
        if(machineStatus.equals("down")) {
          //status.append("<span class=\"health_red\""+">");
          status.append(DuccHandlerUtils.down());
          //status.append("</span>");
        }
        else if(machineStatus.equals("up")) {
          //status.append("<span class=\"health_green\""+">");
          status.append(DuccHandlerUtils.up());
          //status.append("</span>");
        }
        else {
          status.append(DuccHandlerUtils.unknown());
        }
        sb.append("<td>");
        sb.append(status);
        sb.append("</td>")
        sb.append("</td>")
        // Daemon Name
        String daemonName = "Agent";
        sb.append("<td>");
        sb.append(daemonName);
        sb.append("</td>")
        // Boot Time
        String bootTime = getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,""));
        sb.append("<td>");
        sb.append(bootTime);
        sb.append("</td>");
        // Host IP
        String hostIP = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,"");
        sb.append("<td>");
        sb.append(hostIP);
        sb.append("</td>")
        // Host Name
        String hostName = machineInfo.getName();
        sb.append("<td>");
        sb.append(hostName);
        sb.append("</td>");
        // PID
        String pid = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,"");
        sb.append("<td>");
        sb.append(pid);
        sb.append("</td>");
        // Publication Size (last)
        String publicationSizeLast = machineInfo.getPublicationSizeLast();
        sb.append("<td align=\"right\">");
        sb.append(publicationSizeLast);
        sb.append("</td>")
        // Publication Size (max)
        String publicationSizeMax = machineInfo.getPublicationSizeMax();
        sb.append("<td align=\"right\">");
        sb.append(publicationSizeMax);
        sb.append("</td>")
        // Heartbeat (last)
        String heartbeatLast = machineInfo.getHeartbeatLast();
        sb.append("<td align=\"right\">");
        sb.append(heartbeatLast);
        sb.append("</td>")
        // Heartbeat (max)
        long heartbeatMax = machineInfo.getHeartbeatMax();
        sb.append("<td align=\"right\">");
        if(heartbeatMax > 0) {
          sb.append(heartbeatMax);
        }
        sb.append("</td>");
        // Heartbeat (max) TOD
        String fmtHeartbeatMaxTOD = "";
        long heartbeatMaxTOD = machineInfo.getHeartbeatMaxTOD();
        if(heartbeatMaxTOD > 0) {
          fmtHeartbeatMaxTOD = TimeStamp.simpleFormat(""+heartbeatMaxTOD);
          try {
            fmtHeartbeatMaxTOD = getTimeStamp(DuccCookies.getDateStyle(request),fmtHeartbeatMaxTOD);
          }
View Full Code Here

TOP

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

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.