Class Logger

java.lang.Object
org.objectweb.howl.log.LogObject
org.objectweb.howl.log.Logger
Direct Known Subclasses:
XALogger

public class Logger extends LogObject
Manage a configured set of two or more physical log files.

Log files have a configured maximum size. When a file has reached the configured capacity, Logger switches to the next available alternate file. Normally, log files are created in advance to guarantee that space is available during execution.

Each log file has a file header containing information allowing Logger to reposition and replay the logs during a recovery scenario.

LogFile marking

The LogFile's mark is the the position within the file of the oldest active entry. Initially the mark is set at the beginning of the file. At some configured interval, the caller invokes mark() with the key of the oldest active entry in the log.

For XA the key would be for the oldest transaction still in committing state. In theory, XA could call mark() every time a DONE record is logged. In practice, it should only be necessary to call mark() every minute or so depending on the capacity of the log files.

The Logger maintains an active mark within the set of log files. A file may be reused only if the mark does not reside within the file. The Logger will throw LogFileOverflowException if an attempt is made to switch to a file that contains a mark.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) LogBufferManager
    Manages a pool of buffers used for log file IO.
    protected boolean
    indicates whether the LogFile is open.
    (package private) LogFileManager
    Manages a pool of files used for log file IO.

    Fields inherited from class org.objectweb.howl.log.LogObject

    config
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a Logger using default Configuration object.
    Construct a Logger using a Configuration supplied by the caller.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    close the Log files and perform necessary cleanup tasks.
    get(LogRecord lr, long mark)
    Read a specific record from the log.
    long
     
    Read the journal record that follows the record identified by lr.
    return an XML node containing statistics for the Logger, the LogFile pool and the LogBuffer pool.
    void
    mark(long key)
    calls Logger.mark(key, force) with force set to true .
    void
    mark(long key, boolean force)
    sets the LogFile's mark.
    void
    open Log files and perform necessart initialization.
    long
    put(byte[][] data, boolean sync)
    add a USER record consisting of byte[][] to log.
    long
    put(byte[] data, boolean sync)
    add a USER record consisting of byte[] to the log.
    protected long
    put(short type, byte[][] data, boolean sync)
    Sub-classes call this method to write log records with a specific record type.
    void
    Replays log from the active mark forward to the current position.
    void
    replay(ReplayListener listener, long mark)
    Replays log from a specified mark forward to the current mark.
    protected void
    replay(ReplayListener listener, long mark, boolean replayCtrlRecords)
    Allows sub-classes of Logger to replay control records.
    void
    setAutoMark(boolean autoMark)
    Sets the LogFile marking mode.
    void
    Registers a LogEventListener for log event notifications.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait