Class TransactionLogCursor

java.lang.Object
bitronix.tm.journal.TransactionLogCursor

public class TransactionLogCursor extends Object
Used to read TransactionLogRecord objects from a log file.
Author:
lorban
  • Constructor Details

    • TransactionLogCursor

      public TransactionLogCursor(File file) throws IOException
      Create a TransactionLogCursor that will read from the specified file. This opens a new read-only file descriptor.
      Parameters:
      file - the file to read logs from
      Throws:
      IOException - if an I/O error occurs.
  • Method Details

    • readLog

      public TransactionLogRecord readLog() throws IOException
      Fetch the next TransactionLogRecord from log, recalculating the CRC and checking it against the stored one. InvalidChecksumException is thrown if the check fails.
      Returns:
      the TransactionLogRecord or null if the end of the log file has been reached
      Throws:
      IOException - if an I/O error occurs.
    • readLog

      public TransactionLogRecord readLog(boolean skipCrcCheck) throws IOException
      Fetch the next TransactionLogRecord from log.
      Parameters:
      skipCrcCheck - if set to false, the method will thow an InvalidChecksumException if the CRC on disk does not match the recalculated one. Otherwise, the CRC is not recalculated nor checked agains the stored one.
      Returns:
      the TransactionLogRecord or null if the end of the log file has been reached
      Throws:
      IOException - if an I/O error occurs.
    • close

      public void close() throws IOException
      Close the cursor and the underlying file
      Throws:
      IOException - if an I/O error occurs.