Public Member Functions | |
LogReceiver () | |
boolean | isVerbose () |
void | setVerbose (boolean verbose) |
boolean | initialize () |
boolean | initialize (ORB theORB, Manager manager, int timeoutSeconds) |
boolean | isInitialized () |
void | setDelayMillis (long newDelayMillis) |
long | getDelayMillis () |
BlockingQueue< DelayedLogEntry > | getLogQueue () |
String[] | getStatusReports () |
void | stop () |
void | startCaptureLogs (final PrintWriter logWriter) throws IOException |
void | startCaptureLogs (final PrintWriter logWriter, ThreadFactory threadFactory) throws IOException |
void | stopCaptureLogs () |
Protected Attributes | |
LCEngine | lct |
MyRemoteResponseCallback | rrc |
Private Attributes | |
boolean | verbose = false |
DelayQueue< DelayedLogEntry > | logDelayQueue |
ArrayList< String > | statusReports |
volatile boolean | listenForLogs |
volatile long | sortingDelayMillis = 20000 |
For a client of this class to consume these log messages, method getLogQueue() provides a java.util.concurrent.BlockingQueue from which the client can extract the messages.
Before log messages can be received, initialize(ORB, Manager) must be called. To disconnect from the the log stream, call stop().
As an alternative to getLogQueue
and stop
, this class also offers the method pair startCaptureLogs(PrintWriter) and stopCaptureLogs(). These methods can be used to directly print the received log messages to some writer, sparing the effort of listening on the LogQueue. Method stopCaptureLogs() must be called in that case to stop capturing logs.
|
|
|
|
|
Gets access to the log record queue, from which the time-sorted log records should be fetched. The queue elements are of type DelayedLogEntry, from which the log record can be extracted using the method DelayedLogEntry#getLogEntry().
|
|
Gets the status reports. Currently only a forceful disconnect would be shown, the rest is ignored. TODO: separate good and bad status reports
|
|
Variant of initialize() which takes an existing ORB and manager reference.
This method attempts to wait for successful initialization for up to
|
|
Initializes the connection to the logging channel, which leads to log entries getting written to the sorting queue. To reuse an existing ORB and manager reference, use initialize(ORB, Manager) instead of this method.
This method attempts to wait for successful initialization for up to 10 seconds. If initialization did not happen within this time, If you call this method, make sure to subsequently call getLogQueue() and drain the queue at your own responsibility, or to call startCaptureLogs(PrintWriter) (or startCaptureLogs(PrintWriter, ThreadFactory)) which will drain the queue automatically.
|
|
|
|
|
|
Sets the delay that a log record's timestamp must have with respect to the current system time in order to be allowed to leave the sorting queue.
|
|
|
|
Variant of startCaptureLogs(PrintWriter) which takes an optional ThreadFactory which will be used to create the thread that reads out the log queue. This method could be used if |
|
Convenience method to capture logs directly into a PrintWriter. Method initialize(ORB, Manager) must be called as a precondition. Method stopCaptureLogs() must be called to stop writing logs to
|
|
Disconnects from the logging channel. A special "queue poison" version of DelayedLogEntry will be added to the queue with zero delay, so that all clients who fetch log recored of the queue obtained from getLogQueue() know that the show is over.
|
|
Stops capturing logs into the PrintWriter that was provided to startCaptureLogs(PrintWriter) or any of the related methods. Even though the call to this method returns immediately, all log records that are currently residing inside the queue will still be written out, waiting the due time to allow sorting them. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|