Class JournalFile
- java.lang.Object
-
- net.timewalker.ffmq4.storage.data.impl.journal.JournalFile
-
public final class JournalFile extends Object
JournalFile
-
-
Field Summary
Fields Modifier and Type Field Description static StringRECYCLED_SUFFIXstatic StringSUFFIX
-
Constructor Summary
Constructors Constructor Description JournalFile(int index, String baseName, File dataFolder, long maxJournalSize, int writeBufferSize, int storageSyncMethod, boolean preAllocateFiles)Constructor (new file)JournalFile(int index, String baseName, File dataFolder, File recycledFile, int writeBufferSize, int storageSyncMethod)Constructor (recycled file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseAndDelete()Close and delete the journal fileFilecloseAndRecycle()Close and recycle the journal fileprotected voidcomplete()longgetLastTransactionId()booleanisComplete()voidsetLastTransactionId(long lastTransactionId)longsize()protected voidsync()Force file content sync to diskStringtoString()voidwrite(byte[] data)voidwriteByte(int v)voidwriteInt(int v)voidwriteLong(long v)
-
-
-
Field Detail
-
SUFFIX
public static final String SUFFIX
- See Also:
- Constant Field Values
-
RECYCLED_SUFFIX
public static final String RECYCLED_SUFFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JournalFile
public JournalFile(int index, String baseName, File dataFolder, long maxJournalSize, int writeBufferSize, int storageSyncMethod, boolean preAllocateFiles) throws JournalExceptionConstructor (new file)- Throws:
JournalException
-
JournalFile
public JournalFile(int index, String baseName, File dataFolder, File recycledFile, int writeBufferSize, int storageSyncMethod) throws JournalExceptionConstructor (recycled file)- Throws:
JournalException
-
-
Method Detail
-
sync
protected void sync() throws JournalExceptionForce file content sync to disk- Throws:
JournalException
-
complete
protected void complete() throws JournalException- Throws:
JournalException
-
write
public void write(byte[] data) throws JournalException- Throws:
JournalException
-
writeByte
public void writeByte(int v) throws JournalException- Throws:
JournalException
-
writeInt
public void writeInt(int v) throws JournalException- Throws:
JournalException
-
writeLong
public void writeLong(long v) throws JournalException- Throws:
JournalException
-
size
public long size()
-
isComplete
public boolean isComplete()
- Returns:
- the complete
-
setLastTransactionId
public void setLastTransactionId(long lastTransactionId)
- Parameters:
lastTransactionId- the lastTransactionId to set
-
getLastTransactionId
public long getLastTransactionId()
- Returns:
- the lastTransactionId
-
closeAndDelete
public void closeAndDelete() throws JournalExceptionClose and delete the journal file- Throws:
JournalException
-
closeAndRecycle
public File closeAndRecycle() throws JournalException
Close and recycle the journal file- Throws:
JournalException
-
close
public void close() throws JournalException- Throws:
JournalException
-
-