MonitorTaskpublic abstract class MonitorTask extends TimerTask
Fields Summary |
---|
final int | NUM_ROWS | int | counter | ServerRootMonitor | srm | String | monitorType | String | filter | Timer | timer | File | fileName | boolean | verbose | static final com.sun.enterprise.util.i18n.StringManager | localStrings |
Constructors Summary |
---|
public MonitorTask()
| public MonitorTask(ServerRootMonitor srm, String filter, Timer timer, boolean verbose, File fileName)
this.srm = srm;
this.timer = timer;
if (filter != null)
this.filter = filter;
this.verbose = verbose;
this.fileName = fileName;
|
Methods Summary |
---|
void | cancelMonitorTask()
timer.cancel();
final String msg = localStrings.getString("commands.monitor.press_to_quit");
CLILogger.getInstance().printMessage(msg);
| void | checkForNumberOfElements(java.lang.String[] keys)
if (keys.length<1)
{
throw new MonitorTaskException(localStrings.getString("command.monitor.no_value_to_monitor"));
}
else if (keys.length > 1)
{
StringBuffer sb = new StringBuffer();
sb.append(localStrings.getString("commands.monitor.more_than_one_monitoring_elements"));
sb.append(localStrings.getString("commands.monitor.available_elements"));
for (String key: keys) {
sb.append(" ");
sb.append(key);
sb.append("\n");
}
throw new MonitorTaskException(sb.toString());
}
| public abstract void | displayDetails()
| synchronized void | writeToFile(java.lang.String text)
try {
BufferedWriter out = new BufferedWriter(new FileWriter(fileName, true));
out.append(text);
out.newLine();
out.close();
}
catch (IOException ioe) {
final String unableToWriteFile = localStrings.getString("commands.monitor.unable_to_write_to_file", new Object[] {fileName.getName()});
CLILogger.getInstance().printMessage(unableToWriteFile);
if (verbose) {
ioe.printStackTrace();
}
}
|
|