@ThreadSafe public class LocalJournal extends Object implements ChangeJournal
ChangeSet (either local or remove) on the local FS.ChangeJournal.Records| Modifier | Constructor and Description |
|---|---|
protected |
LocalJournal(String journalLocation) |
|
LocalJournal(String journalLocation,
boolean asyncWritesEnabled,
int maxDaysToKeepEntries)
Creates a new journal instance, in stopped state.
|
| 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 String |
getJournalLocation() |
String |
journalId()
Returns the id of this change journal.
|
JournalRecord |
lastRecord()
Returns the last record from the journal.
|
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.
|
protected void |
removeRecordsOlderThan(long millisInUtc) |
void |
shutdown()
Stops the journal.
|
void |
start()
Starts this journal instance.
|
protected LocalJournal |
withSearchTimeDelta(long searchTimeDelta) |
public LocalJournal(String journalLocation, boolean asyncWritesEnabled, int maxDaysToKeepEntries)
journalLocation - the folder location on the FS where the entries should be saved. Must not be nullasyncWritesEnabled - flag which indicates if disk write should be asynchronous or not.maxDaysToKeepEntries - the maximum number of days this journal should store entries on disk. A negative value or 0protected LocalJournal(String journalLocation)
public void start()
throws RepositoryException
ChangeJournalstart in interface ChangeJournalRepositoryExceptionpublic void shutdown()
ChangeJournalshutdown in interface ChangeJournalpublic void notify(ChangeSet changeSet)
ChangeSetListenernotify in interface ChangeSetListenerchangeSet - a non-null ChangeSetpublic void addRecords(JournalRecord... records)
ChangeJournaladdRecords in interface ChangeJournalrecords - a JournalRecord array.public void removeOldRecords()
ChangeJournalremoveOldRecords in interface ChangeJournalprotected void removeRecordsOlderThan(long millisInUtc)
protected String getJournalLocation()
public 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 String journalId()
ChangeJournaljournalId in interface ChangeJournalString, never nullprotected LocalJournal withSearchTimeDelta(long searchTimeDelta)
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.