JavaXT
|
|
StatusLogger ClassUsed 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 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(); ConstructorsPublic MethodssetTotalRecords( 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. 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. |