|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JournalManager
This manager is an entry point to the journal subsystem.
Typical way to use journal subsystem is to call enqueue(JournalEntry)
to queue new entries that should be actioned on each cluster node. Later on
queued entries can be processed by calling
processEntries(com.atlassian.confluence.api.model.journal.JournalIdentifier, int, com.google.common.base.Function)
on each cluster node. Subsequent calls to processEntries will be
passed only entries that were added since the last call on that cluster
node.
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. |
|
java.lang.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<java.lang.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 |
waitForRecentEntriesToBecomeVisible()
Waits long enough to ensure that entries added before calling this method will be available to subsequent call to processEntries(JournalIdentifier, int, com.google.common.base.Function) . |
Method Detail |
---|
long enqueue(@Nonnull JournalEntry entry) throws org.springframework.dao.DataAccessException
New journal is automatically created if a journal with the given name does not exists.
entry
- entry to persist
org.springframework.dao.DataAccessException
- if the entry could
not be persisted<V> V processEntries(@Nonnull JournalIdentifier journalId, int maxEntries, @Nonnull com.google.common.base.Function<java.lang.Iterable<JournalEntry>,EntryProcessorResult<V>> entryProcessor) throws org.springframework.dao.DataAccessException
This method does not return entries that were added immediately before
calling this method. Use 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.
journalId
- 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 savedvoid waitForRecentEntriesToBecomeVisible() throws java.lang.InterruptedException
processEntries(JournalIdentifier, int, com.google.common.base.Function)
.
java.lang.InterruptedException
- if the thread got interruptedjava.lang.Iterable<JournalEntry> peek(@Nonnull JournalIdentifier journalId, int maxEntries)
journalId
- only entries with this journal id will be returnedmaxEntries
- maximum number of entries to return
void reset(@Nonnull JournalIdentifier journalId)
journalId
- identifier of the journal to resetint countEntries(@Nonnull JournalIdentifier journalId)
journalId
- identifier of the journal
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |