public interface Journal
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the Journal.
|
RecordLocation |
getMark()
Obtains the mark that was set in the Journal.
|
RecordLocation |
getNextRecordLocation(RecordLocation location)
Allows you to get the next RecordLocation after the
location that
is in the journal. |
Packet |
read(RecordLocation location)
Reads a previously written record from the journal.
|
void |
setJournalEventListener(JournalEventListener listener)
Registers a
JournalEventListener that will receive notifications from the Journal. |
void |
setMark(RecordLocation location,
boolean sync)
Informs the journal that all the journal space up to the
location is no longer
needed and can be reclaimed for reuse. |
RecordLocation |
write(Packet packet,
boolean sync)
Writes a
Packet of data to the journal. |
RecordLocation write(Packet packet, boolean sync) throws IOException, IllegalStateException
Packet
of data to the journal. If sync
is true, then this call blocks until the data has landed on the physical
disk. Otherwise, this enqueues the write request and returns.record
- - the data to be written to disk.sync
- - If this call should block until the data lands on disk.IOException
- if the write failed.IllegalStateException
- if the journal is closed.Packet read(RecordLocation location) throws InvalidRecordLocationException, IOException, IllegalStateException
location
- is where to read the record from.location
.InvalidRecordLocationException
- if location
parameter is out of range.
It cannot be a location that is before the current mark.IOException
- if the record could not be read.IllegalStateException
- if the journal is closed.void setMark(RecordLocation location, boolean sync) throws InvalidRecordLocationException, IOException, IllegalStateException
location
is no longer
needed and can be reclaimed for reuse.location
- the location of the record to mark. All record locations before the marked
location will no longger be vaild.sync
- if this call should block until the mark is set on the journal.InvalidRecordLocationException
- if location
parameter is out of range.
It cannot be a location that is before the current mark.IOException
- if the record could not be read.IllegalStateException
- if the journal is closed.RecordLocation getMark() throws IllegalStateException
IllegalStateException
- if the journal is closed.read(RecordLocation location);
void close() throws IOException
IOException
- if an error occurs while the journal is being closed.RecordLocation getNextRecordLocation(RecordLocation location) throws InvalidRecordLocationException, IOException, IllegalStateException
location
that
is in the journal.location
- the reference location the is used to find the next location.
To get the oldest location available in the journal, location
should be set to null.InvalidRecordLocationException
- if location
parameter is out of range.
It cannot be a location that is before the current mark.IllegalStateException
- if the journal is closed.IOException
void setJournalEventListener(JournalEventListener listener) throws IllegalStateException
JournalEventListener
that will receive notifications from the Journal.listener
- object that will receive journal events.IllegalStateException
- if the journal is closed.Copyright © 2005–2016 The Apache Software Foundation. All rights reserved.