cz.vutbr.fit.racedetector
Class LogProducer

java.lang.Object
  extended by cz.vutbr.fit.racedetector.LogProducer

public class LogProducer
extends java.lang.Object

A simple tool for writing to specified file. Writing to the file can be potentionally slow and shouldn't be done by producing thread - therefore this job is delegated to LoggerThread controlled by the LogProducer.

Author:
zdenek

Field Summary
 boolean isLoggerDone
           
 java.lang.String POISON_PILL
          Delimiter - if this delimiter is taken from the queue - file is closed and thread terminated.
 
Constructor Summary
LogProducer(java.io.BufferedWriter oFile)
          Constructor prepare the LoggerThread.
 
Method Summary
 void queueMsg(java.lang.String msg)
          Add a message to the queue.
 void startLog()
          Starts the LoggerThread.
 void waitTillEnd()
          Wait for the end of LoggerThread which is writing the output file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POISON_PILL

public final java.lang.String POISON_PILL
Delimiter - if this delimiter is taken from the queue - file is closed and thread terminated.

See Also:
Constant Field Values

isLoggerDone

public volatile boolean isLoggerDone
Constructor Detail

LogProducer

public LogProducer(java.io.BufferedWriter oFile)
Constructor prepare the LoggerThread.

Parameters:
oFile - Specified output file
Method Detail

startLog

public void startLog()
Starts the LoggerThread.


queueMsg

public void queueMsg(java.lang.String msg)
Add a message to the queue.

Parameters:
msg - Text to be written.

waitTillEnd

public void waitTillEnd()
Wait for the end of LoggerThread which is writing the output file.