public final class StatusReport extends Object implements TimerTaskListener
java.util.logging.Logger is the application's
root log. The default logging level is
java.util.logging.Level.INFO.
When the timer expires it generates a report containing:
StatusReporter's
statistics.
StatusReporter| Modifier and Type | Class and Description |
|---|---|
static class |
StatusReport.ReportFrequency
Enumerates the allowed status report frequencies:
FIVE_MINUTE: generate a report every five minutes on
the five minute.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deregister(StatusReporter reporter)
Deregisters a status reporter.
|
static String |
formatTime(long delta)
Given a millisecond duration, generate a string that
reports the duration in human-readable form.
|
boolean |
getDumpThreads()
Returns the "dump threads" flag.
|
static StatusReport |
getInstance()
Returns the singleton
StatusReport instance. |
Level |
getLevel()
Returns the
java.util.logging.Level at which
the status report is logged. |
Logger |
getLogger()
Returns the
java.util.logging.Logger to which
the status report is written. |
StatusReport.ReportFrequency |
getReportFrequency()
Returns the current status report frequency in
milliseconds.
|
void |
handleTimeout(TimerEvent event)
Time to output another status report.
|
void |
register(StatusReporter reporter)
Registers a status reporter.
|
void |
setApplicationInfo(String name,
String version,
Date buildDate,
String boilerPlate)
Sets the application's name, version and build date.
|
void |
setDumpThreads(boolean flag)
Sets the "dump threads" flag to the given value.
|
void |
setLevel(Level level)
Sets the
java.util.logging.Level at which
the status report is logged. |
void |
setLogger(Logger logger)
Sets the
java.util.logging.Logger. |
void |
setReportFrequency(StatusReport.ReportFrequency frequency)
Sets the status report frequency.
|
public void handleTimeout(TimerEvent event)
DO NOT CALL THIS METHOD! This method is called when the report timer expires.
handleTimeout in interface TimerTaskListenerevent - the expired timer event.public Logger getLogger()
java.util.logging.Logger to which
the status report is written.java.util.logging.Logger to which
the status report is written.public Level getLevel()
java.util.logging.Level at which
the status report is logged.java.util.logging.Level at which
the status report is logged.public StatusReport.ReportFrequency getReportFrequency()
public boolean getDumpThreads()
true, then the active threds are
listed in the report. This flag is false by
default.public void setLogger(Logger logger)
java.util.logging.Logger. The
status report is written to this logger.logger - write the status report to this log.public void setLevel(Level level) throws IllegalArgumentException
java.util.logging.Level at which
the status report is logged.level - log the status report at this level.IllegalArgumentException - if level is null.public void setReportFrequency(StatusReport.ReportFrequency frequency)
java.lang.IllegalArgumentException is thrown.frequency - the status report frequency.public void setDumpThreads(boolean flag)
true, then the active threads
are listed in the report.flag - set the "dump threads" flag to this value.public void setApplicationInfo(String name, String version, Date buildDate, String boilerPlate) throws IllegalStateException
name - the application's name.version - the application's version.buildDate - the application's build date.boilerPlate - usually a copyright statement.IllegalStateException - if the application information is already set.public void register(StatusReporter reporter)
Note: When the status report is generated, reporters will be called in the order they register.
reporter - register this status reporter.public void deregister(StatusReporter reporter)
reporter - deregister this reporter.public static StatusReport getInstance()
StatusReport instance.StatusReport instance.public static String formatTime(long delta)
delta - The millisecond duration.Copyright © 2019. All rights reserved.