com.threerings.presents.server
Class ReportManager

java.lang.Object
  extended by com.threerings.presents.server.ReportManager

public class ReportManager
extends Object

Handles the generation of server status reports.


Nested Class Summary
static interface ReportManager.Reporter
          Used to generate "state of the server" reports.
 
Field Summary
protected  long _lastReportStamp
          The last time at which generateReport(String,long,boolean) was run.
protected  RootDObjectManager _omgr
          We use the root omgr to queue up our reporting interval.
protected  Multimap<String,ReportManager.Reporter> _reporters
          Used to generate "state of server" reports.
protected  long _serverStartTime
          The time at which the server was started.
static String DEFAULT_TYPE
          A string constant representing the default report.
protected static String LOG_REPORT_HEADER
          The header to prefix to our logged reports.
static String PROFILE_TYPE
          A string constant representing a report with detailed profiling information.
protected static long REPORT_INTERVAL
          The frequency with which we generate "state of server" reports.
 
Constructor Summary
ReportManager()
           
 
Method Summary
 void activatePeriodicReport()
          Starts up our periodic report generation task.
 String generateReport()
          Generate a default state of server report.
 String generateReport(String type)
          Generates a report for all system services registered as a ReportManager.Reporter.
protected  String generateReport(String type, long now, boolean reset)
          Generates and logs a "state of server" report.
protected  long getReportInterval()
          Returns the period on which to schedule our report generation.
protected  void logReport(String report)
          Logs the state of the server report via the default logging mechanism.
 void registerReporter(ReportManager.Reporter reporter)
          Registers a reporter for the default state of server report.
 void registerReporter(String type, ReportManager.Reporter reporter)
          Registers a reporter for the report of the specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TYPE

public static final String DEFAULT_TYPE
A string constant representing the default report.

See Also:
Constant Field Values

PROFILE_TYPE

public static final String PROFILE_TYPE
A string constant representing a report with detailed profiling information.

See Also:
Constant Field Values

_serverStartTime

protected long _serverStartTime
The time at which the server was started.


_lastReportStamp

protected long _lastReportStamp
The last time at which generateReport(String,long,boolean) was run.


_reporters

protected Multimap<String,ReportManager.Reporter> _reporters
Used to generate "state of server" reports.


_omgr

@Inject
protected RootDObjectManager _omgr
We use the root omgr to queue up our reporting interval.


REPORT_INTERVAL

protected static final long REPORT_INTERVAL
The frequency with which we generate "state of server" reports.

See Also:
Constant Field Values

LOG_REPORT_HEADER

protected static final String LOG_REPORT_HEADER
The header to prefix to our logged reports.

See Also:
Constant Field Values
Constructor Detail

ReportManager

public ReportManager()
Method Detail

activatePeriodicReport

public void activatePeriodicReport()
Starts up our periodic report generation task.


registerReporter

public void registerReporter(ReportManager.Reporter reporter)
Registers a reporter for the default state of server report.


registerReporter

public void registerReporter(String type,
                             ReportManager.Reporter reporter)
Registers a reporter for the report of the specified type.


generateReport

public String generateReport()
Generate a default state of server report.


generateReport

public String generateReport(String type)
Generates a report for all system services registered as a ReportManager.Reporter.


generateReport

protected String generateReport(String type,
                                long now,
                                boolean reset)
Generates and logs a "state of server" report.


logReport

protected void logReport(String report)
Logs the state of the server report via the default logging mechanism. Derived classes may wish to log the state of the server report via a different means.


getReportInterval

protected long getReportInterval()
Returns the period on which to schedule our report generation.