|
|
|
@ -42,6 +42,16 @@ public class HeartBeat {
|
|
|
|
|
private int workerWaitingTaskCount; // worker waiting task count
|
|
|
|
|
private int workerExecThreadCount; // worker thread pool thread count
|
|
|
|
|
|
|
|
|
|
private double diskAvailable; |
|
|
|
|
|
|
|
|
|
public double getDiskAvailable() { |
|
|
|
|
return diskAvailable; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setDiskAvailable(double diskAvailable) { |
|
|
|
|
this.diskAvailable = diskAvailable; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public long getStartupTime() { |
|
|
|
|
return startupTime; |
|
|
|
|
} |
|
|
|
@ -177,6 +187,7 @@ public class HeartBeat {
|
|
|
|
|
this.loadAverage = OSUtils.loadAverage(); |
|
|
|
|
this.availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); |
|
|
|
|
this.memoryUsage = OSUtils.memoryUsage(); |
|
|
|
|
this.diskAvailable = OSUtils.diskAvailable(); |
|
|
|
|
this.processId = OSUtils.getProcessID(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -207,6 +218,7 @@ public class HeartBeat {
|
|
|
|
|
StringBuilder builder = new StringBuilder(100); |
|
|
|
|
builder.append(cpuUsage).append(COMMA); |
|
|
|
|
builder.append(memoryUsage).append(COMMA); |
|
|
|
|
builder.append(diskAvailable).append(COMMA); |
|
|
|
|
builder.append(loadAverage).append(COMMA); |
|
|
|
|
builder.append(availablePhysicalMemorySize).append(Constants.COMMA); |
|
|
|
|
builder.append(maxCpuloadAvg).append(Constants.COMMA); |
|
|
|
@ -233,17 +245,18 @@ public class HeartBeat {
|
|
|
|
|
HeartBeat heartBeat = new HeartBeat(); |
|
|
|
|
heartBeat.cpuUsage = Double.parseDouble(parts[0]); |
|
|
|
|
heartBeat.memoryUsage = Double.parseDouble(parts[1]); |
|
|
|
|
heartBeat.loadAverage = Double.parseDouble(parts[2]); |
|
|
|
|
heartBeat.availablePhysicalMemorySize = Double.parseDouble(parts[3]); |
|
|
|
|
heartBeat.maxCpuloadAvg = Double.parseDouble(parts[4]); |
|
|
|
|
heartBeat.reservedMemory = Double.parseDouble(parts[5]); |
|
|
|
|
heartBeat.startupTime = Long.parseLong(parts[6]); |
|
|
|
|
heartBeat.reportTime = Long.parseLong(parts[7]); |
|
|
|
|
heartBeat.serverStatus = Integer.parseInt(parts[8]); |
|
|
|
|
heartBeat.processId = Integer.parseInt(parts[9]); |
|
|
|
|
heartBeat.workerHostWeight = Integer.parseInt(parts[10]); |
|
|
|
|
heartBeat.workerExecThreadCount = Integer.parseInt(parts[11]); |
|
|
|
|
heartBeat.workerWaitingTaskCount = Integer.parseInt(parts[12]); |
|
|
|
|
heartBeat.diskAvailable = Double.parseDouble(parts[2]); |
|
|
|
|
heartBeat.loadAverage = Double.parseDouble(parts[3]); |
|
|
|
|
heartBeat.availablePhysicalMemorySize = Double.parseDouble(parts[4]); |
|
|
|
|
heartBeat.maxCpuloadAvg = Double.parseDouble(parts[5]); |
|
|
|
|
heartBeat.reservedMemory = Double.parseDouble(parts[6]); |
|
|
|
|
heartBeat.startupTime = Long.parseLong(parts[7]); |
|
|
|
|
heartBeat.reportTime = Long.parseLong(parts[8]); |
|
|
|
|
heartBeat.serverStatus = Integer.parseInt(parts[9]); |
|
|
|
|
heartBeat.processId = Integer.parseInt(parts[10]); |
|
|
|
|
heartBeat.workerHostWeight = Integer.parseInt(parts[11]); |
|
|
|
|
heartBeat.workerExecThreadCount = Integer.parseInt(parts[12]); |
|
|
|
|
heartBeat.workerWaitingTaskCount = Integer.parseInt(parts[13]); |
|
|
|
|
return heartBeat; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|