@ThreadSafe public class ClusteredJournal extends MessageConsumer<org.modeshape.jcr.journal.DeltaMessage> implements ChangeJournal
ChangeJournal implementation which runs in a cluster and which attempts to reconcile with other members of the cluster
on startup in order to retrieve missed/lost records.ChangeJournal.Records| Constructor and Description |
|---|
ClusteredJournal(LocalJournal localJournal,
ClusteringService clusteringService)
Creates a new clustered journal
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRecords(JournalRecord... records)
Adds one or more journal records to a journal.
|
ChangeJournal.Records |
allRecords(boolean descendingOrder)
Returns all the records this journal holds
|
protected ClusteringService |
clusteringService() |
protected String |
clusterName() |
void |
consume(org.modeshape.jcr.journal.DeltaMessage message)
Consumes a payload of the given type.
|
String |
journalId()
Returns the id of this change journal.
|
JournalRecord |
lastRecord()
Returns the last record from the journal.
|
protected LocalJournal |
localJournal() |
void |
notify(ChangeSet changeSet)
Notifies a listener of the given changes.
|
ChangeJournal.Records |
recordsNewerThan(org.joda.time.DateTime changeSetTime,
boolean inclusive,
boolean descendingOrder)
Returns all records that have changesets which are newer than a given timestamp.
|
void |
removeOldRecords()
Removes older entries.
|
void |
shutdown()
Stops the journal.
|
void |
start()
Starts this journal instance.
|
getPayloadTypepublic ClusteredJournal(LocalJournal localJournal, ClusteringService clusteringService)
localJournal - the local ChangeJournal which willclusteringService - an ClusteringService instance.public void notify(ChangeSet changeSet)
ChangeSetListenernotify in interface ChangeSetListenerchangeSet - a non-null ChangeSetpublic void start()
throws Exception
ChangeJournalstart in interface ChangeJournalException - if anything fails during startpublic void shutdown()
ChangeJournalshutdown in interface ChangeJournalpublic void removeOldRecords()
ChangeJournalremoveOldRecords in interface ChangeJournalpublic ChangeJournal.Records allRecords(boolean descendingOrder)
ChangeJournalallRecords in interface ChangeJournaldescendingOrder - flag which indicates whether the entriesChangeJournal.Records instancepublic JournalRecord lastRecord()
ChangeJournallastRecord in interface ChangeJournalJournalRecord instance or null if the journal is empty.public ChangeJournal.Records recordsNewerThan(org.joda.time.DateTime changeSetTime, boolean inclusive, boolean descendingOrder)
ChangeJournalrecordsNewerThan in interface ChangeJournalchangeSetTime - the DateTime of the changes representing the lower bound; may be null indicating
that *all the records* should be returned.inclusive - flag indicating whether the timestamp should be used inclusively or exclusivelydescendingOrder - flag indicating if the records should be returned in ascending order (oldest to newest) or
descending order (newest to oldest)ChangeJournal.Records instance; never nullpublic void addRecords(JournalRecord... records)
ChangeJournaladdRecords in interface ChangeJournalrecords - a JournalRecord array.public String journalId()
ChangeJournaljournalId in interface ChangeJournalString, never nullpublic void consume(org.modeshape.jcr.journal.DeltaMessage message)
MessageConsumerconsume in class MessageConsumer<org.modeshape.jcr.journal.DeltaMessage>message - a Serializable payload.protected ClusteringService clusteringService()
protected LocalJournal localJournal()
protected String clusterName()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.