public abstract class AbstractJournal extends Object implements Journal
Constructor and Description |
---|
AbstractJournal() |
Modifier and Type | Method and Description |
---|---|
protected abstract 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.
|
protected RecordProducer |
createProducer(String identifier)
Create the record producer for a given identifier.
|
protected abstract void |
doLock()
Lock the journal revision.
|
protected void |
doSync(long startRevision)
Synchronize contents from journal.
|
protected void |
doSync(long startRevision,
boolean startup) |
protected abstract void |
doUnlock(boolean successful)
Unlock the journal revision.
|
RecordConsumer |
getConsumer(String identifier)
Return the consumer given its identifier.
|
String |
getId()
Return this journal's identifier.
|
NamePathResolver |
getNamePathResolver()
Return this journal's NamePathResolver.
|
RecordProducer |
getProducer(String identifier)
Return the record producer for a given identifier.
|
File |
getRepositoryHome()
Return the repository home.
|
NamespaceResolver |
getResolver()
Return this journal's namespace resolver.
|
String |
getRevision() |
void |
init(String id,
NamespaceResolver resolver)
Initialize journal.
|
void |
lockAndSync()
Lock the journal revision, disallowing changes from other sources until
unlock(boolean) has been called, and synchronizes to the latest change. |
void |
register(RecordConsumer consumer)
Register a record consumer.
|
void |
setInternalVersionManager(InternalVersionManagerImpl internalVersionManager)
Set the version manager.
|
void |
setRepositoryHome(File repHome)
Set the repository home.
|
void |
setRevision(String revision) |
void |
sync(boolean startup)
Synchronize contents from journal.
|
protected boolean |
syncAgainOnNewRecords()
Return a flag indicating whether synchronization should continue
in a loop until no more new records are found.
|
void |
unlock(boolean successful)
Unlock the journal revision.
|
boolean |
unregister(RecordConsumer consumer)
Unregister a record processor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getInstanceRevision, getRecords, getRecords
public void init(String id, NamespaceResolver resolver) throws JournalException
init
in interface Journal
id
- id this journal should use to write its own recordsresolver
- resolver used when reading/writing recordsJournalException
- if an error occurspublic void register(RecordConsumer consumer) throws JournalException
register
in interface Journal
consumer
- record consumerJournalException
- if an error occurspublic boolean unregister(RecordConsumer consumer)
unregister
in interface Journal
consumer
- record processor to unregistertrue
if the consumer was previously registered;
false
otherwisepublic RecordConsumer getConsumer(String identifier)
identifier
- identifiernull
if no consumer is associated with identifierpublic RecordProducer getProducer(String identifier)
getProducer
in interface Journal
identifier
- identifierprotected RecordProducer createProducer(String identifier)
identifier
- producer identifierpublic void sync(boolean startup) throws JournalException
RecordConsumer.consume(org.apache.jackrabbit.core.journal.Record)
method when their identifier
matches the one found in the records.
The startup flag allow for a separate treatment of the initial sync
when the cluster nodes starts up. This might be needed for example
when there are a lot of old revisions in a database.sync
in interface Journal
startup
- indicates if the cluster node is syncing on startup
or does a normal sync.JournalException
- if an error occursprotected void doSync(long startRevision, boolean startup) throws JournalException
JournalException
protected void doSync(long startRevision) throws JournalException
startRevision
- start point (exclusive)JournalException
- if an error occursprotected boolean syncAgainOnNewRecords()
true
if synchronization should continue;
false
otherwisepublic void lockAndSync() throws JournalException
unlock(boolean)
has been called, and synchronizes to the latest change.JournalException
- if an error occurspublic void unlock(boolean successful)
successful
- flag indicating whether the update process was
successfulprotected abstract void doLock() throws JournalException
JournalException
- if an error occursprotected void appending(AppendRecord record)
record
- record that was appendedprotected abstract void append(AppendRecord record, InputStream in, int length) throws JournalException
record
- record to appendin
- input streamlength
- number of bytes in input streamJournalException
- if an error occursprotected abstract void doUnlock(boolean successful)
successful
- flag indicating whether the update process was
successfulpublic String getId()
public NamespaceResolver getResolver()
public NamePathResolver getNamePathResolver()
public void setRepositoryHome(File repHome)
repHome
- repository homepublic void setInternalVersionManager(InternalVersionManagerImpl internalVersionManager)
public File getRepositoryHome()
public String getRevision()
public void setRevision(String revision)
revision
- the path of the cluster node's local revision file to setCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.