TransactionLogAppender (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bitronix.tm.journal
Class TransactionLogAppender

    java.lang.Object
      bitronix.tm.journal.TransactionLogAppender

    public class TransactionLogAppender

extends Object

Used to write `TransactionLogRecord` objects to a log file.

Author:
  lorban

Field Summary
`static int` | `END_RECORD` int-encoded "xntB" ASCII string.

Constructor Summary
`TransactionLogAppender(File file, long maxFileLength)` Create an appender that will write to specified file up to the specified maximum length.

Method Summary
`void` | `close()` Close the appender and the underlying file.
`protected void` | `doForce()`
`void` | `force()` Force flushing the logs to disk
`TransactionLogCursor` | `getCursor()` Creates a cursor on this journal file allowing iteration of its records.
`TransactionLogHeader` | `getHeader()` Return a `TransactionLogHeader` that allows reading and controlling the log file's header.
`String` | `toString()`
`boolean` | `writeLog(TransactionLogRecord tlog)` Write a `TransactionLogRecord` to disk.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### END_RECORD

    public static final int END_RECORD

  int-encoded "xntB" ASCII string. This will be useful after swapping log files since we will potentially overwrite old logs not necessarily of the same size. Very useful when debugging and eventually restoring broken log files.

  See Also:
    Constant Field Values

Constructor Detail

### TransactionLogAppender

    public TransactionLogAppender(File file,
                                  long maxFileLength)
                           throws IOException

  Create an appender that will write to specified file up to the specified maximum length. All disk access are synchronized arround the RandomAccessFile object, including header calls.

  Parameters:
    `file` - the underlying File used to write to disk.
    `maxFileLength` - size of the file on disk that can never be bypassed.
  Throws:
    `IOException` - if an I/O error occurs.

Method Detail

### getHeader

    public TransactionLogHeader getHeader()

  Return a `TransactionLogHeader` that allows reading and controlling the log file's header.

  Returns:
    this log file's TransactionLogHeader

### writeLog

    public boolean writeLog(TransactionLogRecord tlog)
                     throws IOException

  Write a `TransactionLogRecord` to disk.

  Parameters:
    `tlog` - the record to write to disk.
  Returns:
    true if there was room in the log file and the log was written, false otherwise.
  Throws:
    `IOException` - if an I/O error occurs.

### close

    public void close()
               throws IOException

  Close the appender and the underlying file.

  Throws:
    `IOException` - if an I/O error occurs.

### getCursor

    public TransactionLogCursor getCursor()
                                   throws IOException

  Creates a cursor on this journal file allowing iteration of its records. This opens a new read-only file descriptor independent of the write-only one still used for writing transaction logs.

  Returns:
    a TransactionLogCursor.
  Throws:
    `IOException` - if an I/O error occurs.

### force

    public void force()
               throws IOException

  Force flushing the logs to disk

  Throws:
    `IOException` - if an I/O error occurs.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### doForce

    protected void doForce()
                    throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.