public class MemoryJournal extends AbstractJournal
Modifier and Type | Class and Description |
---|---|
static class |
MemoryJournal.MemoryRecord
Memory record.
|
class |
MemoryJournal.MemoryRecordIterator
Record iterator implementation.
|
Constructor and Description |
---|
MemoryJournal() |
Modifier and Type | Method and Description |
---|---|
protected void |
append(AppendRecord record,
InputStream in,
int length)
Append a record backed by a file.
|
protected void |
appending(AppendRecord record)
Notification method called by an appended record at creation time.
|
void |
close()
Close this journal.
|
protected void |
doLock()
Lock the journal revision.
|
protected void |
doUnlock(boolean successful)
Unlock the journal revision.
|
InstanceRevision |
getInstanceRevision()
Gets the instance that manages the cluster node's local revision.
|
long |
getReadDelay()
Return the read delay in milliseconds.
|
RecordIterator |
getRecords()
Return an iterator over all available records in the journal.
|
RecordIterator |
getRecords(long startRevision)
Return an iterator over all records after the specified revision.
|
long |
getWriteDelay()
Return the write delay in milliseconds.
|
void |
init(String id,
NamespaceResolver resolver)
Initialize journal.
|
void |
setReadDelay(long readDelay)
Set the read delay in milliseconds.
|
void |
setRecords(List<MemoryJournal.MemoryRecord> records)
Set records.
|
void |
setWriteDelay(long writeDelay)
Set the write delay in milliseconds.
|
createProducer, doSync, doSync, getConsumer, getId, getNamePathResolver, getProducer, getRepositoryHome, getResolver, getRevision, lockAndSync, register, setInternalVersionManager, setRepositoryHome, setRevision, sync, syncAgainOnNewRecords, unlock, unregister
public InstanceRevision getInstanceRevision() throws JournalException
JournalException
- on errorpublic void init(String id, NamespaceResolver resolver) throws JournalException
init
in interface Journal
init
in class AbstractJournal
id
- id this journal should use to write its own recordsresolver
- resolver used when reading/writing recordsJournalException
- if an error occursprotected void doLock() throws JournalException
doLock
in class AbstractJournal
JournalException
- if an error occursprotected void appending(AppendRecord record)
AbstractJournal
appending
in class AbstractJournal
record
- record that was appendedprotected void append(AppendRecord record, InputStream in, int length) throws JournalException
append
in class AbstractJournal
record
- record to appendin
- input streamlength
- number of bytes in input streamJournalException
- if an error occursprotected void doUnlock(boolean successful)
doUnlock
in class AbstractJournal
successful
- flag indicating whether the update process was
successfulpublic RecordIterator getRecords(long startRevision) throws JournalException
startRevision
- start point (exlusive)JournalException
- if an error occurspublic RecordIterator getRecords() throws JournalException
JournalException
- if an error occurspublic void setRecords(List<MemoryJournal.MemoryRecord> records)
records
- array list that should back up this memory journalpublic long getReadDelay()
public void setReadDelay(long readDelay)
readDelay
- read delaypublic long getWriteDelay()
public void setWriteDelay(long writeDelay)
writeDelay
- write delaypublic void close()
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.