org.jlf.log.smtpMechanism
Class LogEntryQueue

java.lang.Object
  |
  +--org.jlf.log.smtpMechanism.LogEntryQueue

public class LogEntryQueue
extends java.lang.Object

This class holds a queue of log strings.


Field Summary
protected  long lastTimeQueueDumped
          Holds a timestamp for the last time the queue was dumped.
protected  Log log
          Holds the Log that the entry is to be logged for.
protected  int loggingLevel
          Holds the logging level the log entry is to be logged at.
protected  java.util.LinkedList logStrings
          Holds a list of log strings to be logged.
protected  long maxEntries
          Holds the maximum entries allowed in the queue.
protected  long maxLengthStringDump
          Holds the maximum length string to return when queue is dumped.
protected  long queueDumpTimeout
          Holds the length of time, in milliseconds, for a timeout when the queue should be dumped.
 
Constructor Summary
protected LogEntryQueue()
          Protect the default constructor, please use the public parameterized constructor instead!!!
  LogEntryQueue(Log log, int loggingLevel)
          Constructs a log entry with all required parameters.
 
Method Summary
 java.lang.String dumpQueue()
          Dumps the queue, returning at most a max length string.
 void enqueueLogString(java.lang.String logString)
          Adds a log string entry to the queue.
 Log getLog()
          Retrieves the log the entry is for.
 int getLoggingLevel()
          Retrieves the loggingLevel the entry is for.
protected  void retrieveProperties()
          Retrieves properties particular to this queue.
 boolean shouldDumpQueue()
          Checks to see if the queue should be dumped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Log log
Holds the Log that the entry is to be logged for.


loggingLevel

protected int loggingLevel
Holds the logging level the log entry is to be logged at.


logStrings

protected java.util.LinkedList logStrings
Holds a list of log strings to be logged. Have to use a linked list here, otherwise way too slow to remove old entries. TODO: Eventually this should be a real data structure of an ordered map, to facilitate logging to XML instead of a separated string structure.


lastTimeQueueDumped

protected long lastTimeQueueDumped
Holds a timestamp for the last time the queue was dumped.


queueDumpTimeout

protected long queueDumpTimeout
Holds the length of time, in milliseconds, for a timeout when the queue should be dumped.


maxEntries

protected long maxEntries
Holds the maximum entries allowed in the queue.


maxLengthStringDump

protected long maxLengthStringDump
Holds the maximum length string to return when queue is dumped.

Constructor Detail

LogEntryQueue

public LogEntryQueue(Log log,
                     int loggingLevel)
Constructs a log entry with all required parameters.


LogEntryQueue

protected LogEntryQueue()
Protect the default constructor, please use the public parameterized constructor instead!!!

Method Detail

getLog

public Log getLog()
Retrieves the log the entry is for.


getLoggingLevel

public int getLoggingLevel()
Retrieves the loggingLevel the entry is for.


retrieveProperties

protected void retrieveProperties()
Retrieves properties particular to this queue.


enqueueLogString

public void enqueueLogString(java.lang.String logString)
Adds a log string entry to the queue.


shouldDumpQueue

public boolean shouldDumpQueue()
Checks to see if the queue should be dumped.


dumpQueue

public java.lang.String dumpQueue()
Dumps the queue, returning at most a max length string.