public class FileJournal extends AbstractJournal
It is configured through the following properties:
revision
: the filename where the parent cluster node's revision
file should be written to; this is a required property with no default valuedirectory
: the directory where to keep the journal file as
well as the rotated files; this is a required property with no default valuebasename
: the basename of journal files; the default
value is DEFAULT_BASENAME
maximumSize
: the maximum size of an active journal file
before rotating it: the default value is DEFAULT_MAXSIZE
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_INSTANCE_FILE_NAME
Default instance revision file name.
|
Constructor and Description |
---|
FileJournal() |
Modifier and Type | Method and Description |
---|---|
protected void |
append(AppendRecord record,
InputStream in,
int length)
Append a record backed by a file.
|
void |
close()
Close this journal.
|
protected void |
doLock()
Lock the journal revision.
|
protected void |
doUnlock(boolean successful)
Unlock the journal revision.
|
String |
getBasename() |
String |
getDirectory()
Bean getters
|
protected long |
getGlobalRevision() |
InstanceRevision |
getInstanceRevision()
Gets the instance that manages the cluster node's local revision.
|
int |
getMaximumSize() |
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.
|
void |
init(String id,
NamespaceResolver resolver)
Initialize journal.
|
void |
setBasename(String basename) |
void |
setDirectory(String directory)
Bean setters
|
void |
setMaximumSize(int maximumSize) |
appending, createProducer, doSync, doSync, getConsumer, getId, getNamePathResolver, getProducer, getRepositoryHome, getResolver, getRevision, lockAndSync, register, setInternalVersionManager, setRepositoryHome, setRevision, sync, syncAgainOnNewRecords, unlock, unregister
public static final String DEFAULT_INSTANCE_FILE_NAME
public 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 long getGlobalRevision() throws JournalException
JournalException
public RecordIterator getRecords(long startRevision) throws JournalException
startRevision
- start point (exlusive)JournalException
- if an error occurspublic RecordIterator getRecords() throws JournalException
JournalException
- if an error occursprotected void doLock() throws JournalException
doLock
in class AbstractJournal
JournalException
- if an error occursprotected 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 void close()
public InstanceRevision getInstanceRevision() throws JournalException
JournalException
- on errorpublic String getDirectory()
public String getBasename()
public int getMaximumSize()
public void setDirectory(String directory)
public void setBasename(String basename)
public void setMaximumSize(int maximumSize)
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.