|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.impl.journal.DefaultJournalManager
public class DefaultJournalManager
This is the default implementation of
JournalManager.
| Constructor Summary | |
|---|---|
DefaultJournalManager(JournalDao journalDao,
JournalStateStore journalStateStore,
long ignoreWithinMillis)
|
|
| Method Summary | ||
|---|---|---|
int |
countEntries(JournalIdentifier journalId)
Counts the number of entries in a journal. |
|
long |
enqueue(JournalEntry entry)
Adds the given entry to a journal. |
|
long |
getIgnoreWithinMillis()
|
|
Iterable<JournalEntry> |
peek(JournalIdentifier journalId,
int maxEntries)
Return a copy of journal entries that are waiting to be processed. |
|
|
processEntries(JournalIdentifier journalId,
int maxEntries,
com.google.common.base.Function<Iterable<JournalEntry>,EntryProcessorResult<V>> entryProcessor)
Processes journal entries that were added since the last time this method was called for this journal on this cluster node. |
|
void |
reset(JournalIdentifier journalId)
Resets the state of the journal so that all entries currently in the journal will be skipped. |
|
void |
setIgnoreWithinMillis(long ignoreWithinMillis)
|
|
void |
waitForRecentEntriesToBecomeVisible()
Waits long enough to ensure that entries added before calling this method will be available to subsequent call to JournalManager.processEntries(JournalIdentifier, int, com.google.common.base.Function). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultJournalManager(JournalDao journalDao,
JournalStateStore journalStateStore,
long ignoreWithinMillis)
ignoreWithinMillis - entries added within the last given milliseconds are ignored| Method Detail |
|---|
public long enqueue(@Nonnull
JournalEntry entry)
JournalManagerNew journal is automatically created if a journal with the given name does not exists.
enqueue in interface JournalManagerentry - entry to persist
public Iterable<JournalEntry> peek(@Nonnull
JournalIdentifier journalId,
int maxEntries)
JournalManager
peek in interface JournalManagerjournalId - only entries with this journal id will be returnedmaxEntries - maximum number of entries to return
public void reset(@Nonnull
JournalIdentifier journalId)
JournalManager
reset in interface JournalManagerjournalId - identifier of the journal to reset
public int countEntries(@Nonnull
JournalIdentifier journalId)
JournalManager
countEntries in interface JournalManagerjournalId - identifier of the journal
public <V> V processEntries(@Nonnull
JournalIdentifier journalId,
int maxEntries,
@Nonnull
com.google.common.base.Function<Iterable<JournalEntry>,EntryProcessorResult<V>> entryProcessor)
throws org.springframework.dao.DataAccessException
JournalManager
This method does not return entries that were added immediately before
calling this method. Use JournalManager.waitForRecentEntriesToBecomeVisible()
for ensuring these entries will be included.
This method can miss some entries due to identifier assignment and entry insertion not being an atomic operation. The risk of missed entries can be reduced by creating new entries as close to transaction commit as possible.
If entryProcessor throws an exception, the same entries will be returned again when this method is next called for this journal on this cluster node.
New journal is automatically created if a journal with the given name does not exists.
processEntries in interface JournalManagerjournalId - only entries with this journal id will be returnedmaxEntries - maximum number of entries to processentryProcessor - function that will process entries that were added
since the last time
org.springframework.dao.DataAccessException - if entries could not
be fetched or the journal state could not be saved
public void waitForRecentEntriesToBecomeVisible()
throws InterruptedException
JournalManagerJournalManager.processEntries(JournalIdentifier, int, com.google.common.base.Function).
waitForRecentEntriesToBecomeVisible in interface JournalManagerInterruptedException - if the thread got interruptedpublic long getIgnoreWithinMillis()
getIgnoreWithinMillis in interface JournalManagerBackdoorpublic void setIgnoreWithinMillis(long ignoreWithinMillis)
setIgnoreWithinMillis in interface JournalManagerBackdoor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||