StatusLogger Class

Used to print status messages to the standard output stream. Status messages are written every second and appear in the following format:
0 records processed (0 records per second)
A percent completion and an estimated time to completion (ETC) is appended to the status message if a "totalRecords" counter is given.
The status logger is run in a separate thread. The "recordCounter" is updated by the caller. Example:
    AtomicLong recordCounter = new AtomicLong(0);
    StatusLogger statusLogger = new StatusLogger(recordCounter);
    while (true){
       //Execute some process then update the counter
       recordCounter.incrementAndGet();
    }
    statusLogger.shutdown();  

Constructors

StatusLogger( AtomicLong recordCounter )
StatusLogger( AtomicLong recordCounter, AtomicLong totalRecords )

Public Methods

setTotalRecords( long n ) returns void
Used to set the total number of records expected to be processed. By setting the total record count, the status logger will print a percent completion status update.
getTotalRecords( ) returns Long
Returns the total number of records expected to be processed.
setTimeZone( String timezone ) returns void
Used to set the timezone when reporting ETC (estimated time to completion). ETC is rendered only if the total record count is known (see setTotalRecords). If no timezone is specified, ETC will default to the system timezone.
timezoneName of a timezone (e.g. "America/New York", "UTC", etc)
setTimeZone( TimeZone timezone ) returns void
Used to set the timezone when reporting ETC (see above)
getTimeZone( ) returns TimeZone
Returns the timezone used to report ETC (see setTimeZone). Will return null if a timezone has not been set.
separateMessages( boolean b ) returns void
By default, status messages are written to a single line and overwritten with every update. However, this may not be appropriate when an app is writing debug messages to the same output stream. In such cases, it's best to have the status logger write status updates to a new line.
shutdown( ) returns void
Used to stop the status logger.