public class TransactionLogAppender extends Object
TransactionLogRecord objects to a log file.| Modifier and Type | Field and Description |
|---|---|
static int |
END_RECORD
int-encoded "xntB" ASCII string.
|
| Constructor and Description |
|---|
TransactionLogAppender(File file,
long maxFileLength)
Create an appender that will write to specified file up to the specified maximum length.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearDanglingLogs() |
protected void |
close()
Close the appender and the underlying file.
|
protected void |
force()
Force flushing the logs to disk
|
protected TransactionLogCursor |
getCursor()
Creates a cursor on this journal file allowing iteration of its records.
|
protected List<TransactionLogRecord> |
getDanglingLogs() |
long |
getPosition()
Get the current file position.
|
byte |
getState()
Get STATE_HEADER.
|
protected boolean |
setPositionAndAdvance(TransactionLogRecord tlog)
Get the current file position and advance the position by recordSize if
the maximum file length won't be exceeded.
|
void |
setState(byte state)
Set STATE_HEADER.
|
String |
toString() |
protected void |
writeLog(TransactionLogRecord tlog)
Write a
TransactionLogRecord to disk. |
public static final int END_RECORD
public TransactionLogAppender(File file, long maxFileLength) throws IOException
file - the underlying File used to write to disk.maxFileLength - size of the file on disk that can never be bypassed.IOException - if an I/O error occurs.protected boolean setPositionAndAdvance(TransactionLogRecord tlog) throws IOException
tlog - the TransactionLogRecordIOException - if an I/O error occursprotected void writeLog(TransactionLogRecord tlog) throws IOException
TransactionLogRecord to disk.tlog - the record to write to disk.IOException - if an I/O error occurs.protected List<TransactionLogRecord> getDanglingLogs()
protected void clearDanglingLogs()
public byte getState()
public void setState(byte state)
throws IOException
state - the STATE_HEADER value.IOException - if an I/O error occurs.public long getPosition()
protected void close()
throws IOException
IOException - if an I/O error occurs.protected TransactionLogCursor getCursor() throws IOException
IOException - if an I/O error occurs.protected void force()
throws IOException
IOException - if an I/O error occurs.Copyright © 2006-2016 Bitronix Software. All Rights Reserved.