JVMMonitorTaskpublic class JVMMonitorTask extends MonitorTask
Fields Summary |
---|
private final String | displayFormat |
Constructors Summary |
---|
public JVMMonitorTask(ServerRootMonitor srm, String filter, Timer timer, boolean verbose, File fileName)
super(srm, filter, timer, verbose, fileName);
final String jvmTitle = localStrings.getString("commands.monitor.jvm_monitoring_title");
final String title = String.format("%1$45s", jvmTitle);
CLILogger.getInstance().printMessage(title);
displayHeader();
|
Methods Summary |
---|
private void | displayData(JVMStats jvmStats)
final BoundedRangeStatistic heapSize = jvmStats.getHeapSize();
final CountStatistic upTime = jvmStats.getUpTime();
final String data = String.format(displayFormat,
upTime.getCount(),
heapSize.getLowerBound(),
heapSize.getUpperBound(),
heapSize.getLowWaterMark(),
heapSize.getHighWaterMark(),
heapSize.getCurrent());
CLILogger.getInstance().printMessage(data);
if (fileName != null)
{
final String fileData = String.format("%1$s,%2$s,%3$s,%4$s,%5$s,%6$s",
upTime.getCount(),
heapSize.getLowerBound(),
heapSize.getUpperBound(),
heapSize.getLowWaterMark(),
heapSize.getHighWaterMark(),
heapSize.getCurrent());
writeToFile(fileData);
}
| public void | displayDetails()
| private void | displayHeader()
final String upTime = localStrings.getString("commands.monitor.uptime");
final String heapSize = localStrings.getString("commands.monitor.heapsize");
final String current = localStrings.getString("commands.monitor.current");
final String min = localStrings.getString("commands.monitor.min");
final String max = localStrings.getString("commands.monitor.max");
final String low = localStrings.getString("commands.monitor.low");
final String high = localStrings.getString("commands.monitor.high");
final String count = localStrings.getString("commands.monitor.count");
final String header = String.format("%1$-45s %2$-20s", upTime, heapSize);
final String subHeader = String.format(displayFormat, current, min, max, low,
high, count);
CLILogger.getInstance().printMessage(header);
CLILogger.getInstance().printMessage(subHeader);
if (fileName != null) {
writeToFile(upTime+":"+current+","+heapSize+":"+min+","+heapSize+":"+max+","+
heapSize+":"+low+","+heapSize+":"+high+","+heapSize+":"+count);
}
| public void | run()
if (srm == null) {
super.cancelMonitorTask();
return;
}
final JVMStats jvmStats = srm.getJVMMonitor().getJVMStats();
if (jvmStats == null) {
cancelMonitorTask();
return;
}
if (verbose && counter == NUM_ROWS)
{
displayHeader();
counter = 0; //reset to 0
}
displayData(jvmStats);
if (verbose) counter++;
|
|