@NotThreadSafe public class RaftJournalWriter extends Object implements JournalWriter
Constructor and Description |
---|
RaftJournalWriter(long nextSequenceNumberToWrite,
RaftJournalAppender client) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush()
Flushes all the entries written to the underlying storage.
|
long |
getNextSequenceNumberToWrite() |
void |
write(Journal.JournalEntry entry)
Writes an entry.
|
public RaftJournalWriter(long nextSequenceNumberToWrite, RaftJournalAppender client)
nextSequenceNumberToWrite
- the sequence number for the writer to begin writing atclient
- client for writing entries to the journal; the constructed journal writer owns
this client and is responsible for closing itpublic void write(Journal.JournalEntry entry) throws IOException, JournalClosedException
JournalWriter
JournalWriter.flush()
should be called afterwards if we want to make sure the entry
is persisted.write
in interface JournalWriter
entry
- the journal entry to writeIOException
JournalClosedException
public void flush() throws IOException, JournalClosedException
JournalWriter
flush
in interface JournalWriter
IOException
JournalClosedException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long getNextSequenceNumberToWrite()
Copyright © 2023. All Rights Reserved.