Ejemplo n.º 1
0
  public String getUuidStatString(String uuid) {
    ClientStatMachine csm = this.nodeStatus.getClientStat(uuid);
    if (csm == null) {
      return null;
    }
    StringBuffer sb = new StringBuffer();
    String end = "\r\n";

    sb.append("stat of   uuid: " + uuid).append(end);
    sb.append("last tick time: " + DateTimeUtil.formatDate(new Date(csm.getLastTick())))
        .append(end);
    sb.append("last ip addres: " + csm.getLastAddr()).append(end);
    sb.append(
            "last tcp  time: "
                + DateTimeUtil.formatDate(
                    new Date(
                        csm.getMessengerTask() == null
                            ? 0
                            : csm.getMessengerTask().getLastActive())))
        .append(end);
    sb.append("0x10   message: " + csm.has0x10Message()).append(end);
    sb.append("last 0x10 time: " + DateTimeUtil.formatDate(new Date(csm.getLast0x10Time())))
        .append(end);
    sb.append("0x11   message: " + csm.get0x11Message()).append(end);
    sb.append("last 0x11 time: " + DateTimeUtil.formatDate(new Date(csm.getLast0x11Time())))
        .append(end);
    sb.append("0x20   message: " + csm.has0x20Message()).append(end);
    sb.append("last 0x20 time: " + DateTimeUtil.formatDate(new Date(csm.getLast0x20Time())))
        .append(end);
    sb.append("0x20 arry  len: " + csm.getMessage0x20Len()).append(end);

    return sb.toString();
  }
Ejemplo n.º 2
0
  public String getStatusString() {
    StringBuffer sb = new StringBuffer();

    String end = "\r\n";

    sb.append("server start up at: ")
        .append(DateTimeUtil.formatDate(new Date(this.startTime)))
        .append(end);
    long runtime = System.currentTimeMillis() - this.startTime;
    sb.append("up time: ")
        .append(runtime / (1000 * 3600 * 24))
        .append(" day ")
        .append(runtime / (1000 * 3600))
        .append(" hour ")
        .append(runtime / (1000 * 60))
        .append(" minute")
        .append(end);
    sb.append("messagers: ").append(this.workerList.size()).append(end);
    sb.append("current stat machines: ").append(nodeStatus.size()).append(end);
    sb.append("udp recieve packages: ").append(this.udpConnector.getInqueueIn()).append(end);
    sb.append("udp recieve packages pending: ")
        .append(this.udpConnector.getInqueueIn() - this.udpConnector.getInqueueOut())
        .append(end);
    sb.append("udp send packages: ").append(this.udpConnector.getOutqueueIn()).append(end);
    sb.append("udp send packages pending: ")
        .append(this.udpConnector.getOutqueueIn() - this.udpConnector.getOutqueueOut())
        .append(end);
    sb.append("jvm  max  mem: ").append(Runtime.getRuntime().maxMemory()).append(end);
    sb.append("jvm total mem: ").append(Runtime.getRuntime().totalMemory()).append(end);
    sb.append("jvm  free mem: ").append(Runtime.getRuntime().freeMemory()).append(end);
    sb.append("last clean time: ")
        .append(DateTimeUtil.formatDate(new Date(this.cleaner.getLastCleanTime())))
        .append(end);
    sb.append("messengers threads:----------------------").append(end);
    for (int i = 0; i < workerList.size(); i++) {
      Thread t = workerList.get(i).getHostThread();
      sb.append(t.getName() + " stat: " + t.getState().toString()).append(end);
    }
    return sb.toString();
  }