|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Journal is a record logging Interface that can be used to implement a transaction log. This interface was largely extracted out of the HOWL project to allow ActiveMQ to switch between different Journal implementations verry easily.
Method Summary | |
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. |
byte[] |
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(byte[] record,
boolean sync)
Writes a byte array record to the journal. |
Method Detail |
public RecordLocation write(byte[] record, boolean sync) throws IOException, IllegalStateException
record
to the journal. If sync
is true, then this call blocks until the data has landed on the physical
disk. Otherwise, this call returns imeadiatly.
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.public byte[] 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.public 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.public RecordLocation getMark() throws IllegalStateException
IllegalStateException
- if the journal is closed.read(RecordLocation location);
public void close() throws IOException
IOException
- if an error occurs while the journal is being closed.public 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
public 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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |