public class JournaledGroup extends Object implements Journaled
LOG
Constructor and Description |
---|
JournaledGroup(List<Journaled> journaled,
CheckpointName checkpointName)
Creates an instance of a single journaled component, from a list of journaled components.
|
Modifier and Type | Method and Description |
---|---|
CheckpointName |
getCheckpointName() |
List<Journaled> |
getJournaled() |
CloseableIterator<Journal.JournalEntry> |
getJournalEntryIterator() |
boolean |
processJournalEntry(Journal.JournalEntry entry)
Attempts to apply a journal entry.
|
void |
resetState()
Resets the object's journaled state.
|
void |
restoreFromCheckpoint(CheckpointInputStream input)
Restores state from a checkpoint.
|
CompletableFuture<Void> |
restoreFromCheckpoint(File directory,
ExecutorService executorService)
Restores state from a checkpoint asynchronously.
|
CompletableFuture<Void> |
writeToCheckpoint(File directory,
ExecutorService executorService)
Writes a checkpoint to the specified directory asynchronously using the provided executor.
|
void |
writeToCheckpoint(OutputStream output)
Writes a checkpoint of all state to the given output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyAndJournal
public JournaledGroup(List<Journaled> journaled, CheckpointName checkpointName)
journaled
- the list of journaled components to be groupedcheckpointName
- the name of the journal checkpoint for the grouppublic List<Journaled> getJournaled()
public boolean processJournalEntry(Journal.JournalEntry entry)
Journaled
processJournalEntry
in interface Journaled
entry
- the entry to applypublic void resetState()
Journaled
resetState
in interface Journaled
public CheckpointName getCheckpointName()
getCheckpointName
in interface Checkpointed
public CompletableFuture<Void> writeToCheckpoint(File directory, ExecutorService executorService)
Checkpointed
writeToCheckpoint
in interface Checkpointed
directory
- where the checkpoint will be writtenexecutorService
- to use when running tasks asynchronouslypublic void writeToCheckpoint(OutputStream output) throws IOException, InterruptedException
Checkpointed
InterruptedException
if they get
interrupted while running.writeToCheckpoint
in interface Checkpointed
writeToCheckpoint
in interface Journaled
output
- the output stream to write toIOException
InterruptedException
public CompletableFuture<Void> restoreFromCheckpoint(File directory, ExecutorService executorService)
Checkpointed
restoreFromCheckpoint
in interface Checkpointed
directory
- where the checkpoint will be locatedexecutorService
- to use when running asynchronous taskspublic void restoreFromCheckpoint(CheckpointInputStream input) throws IOException
Checkpointed
restoreFromCheckpoint
in interface Checkpointed
restoreFromCheckpoint
in interface Journaled
input
- an input stream with checkpoint dataIOException
public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator()
getJournalEntryIterator
in interface JournalEntryIterable
CloseableIterator
that iterates all the journal entriesCopyright © 2023. All Rights Reserved.