|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.impl.journal.DefaultJournalService
public class DefaultJournalService
This is the default implementation of
JournalService.
| Constructor Summary | |
|---|---|
DefaultJournalService(JournalManager journalManager)
|
|
| 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. |
|
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 |
waitForRecentEntriesToBecomeVisible()
Waits long enough to ensure that entries added before calling this method will be available to subsequent call to JournalService.processEntries(com.atlassian.confluence.api.model.journal.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 DefaultJournalService(JournalManager journalManager)
| Method Detail |
|---|
public long enqueue(@Nonnull
JournalEntry entry)
throws ServiceException
JournalServiceNew journal is automatically created if a journal with the given name does not exists.
enqueue in interface JournalServiceentry - entry to persist
ServiceException - if the entry could not be persisted
public <V> V processEntries(@Nonnull
JournalIdentifier journalId,
int maxEntries,
@Nonnull
com.google.common.base.Function<Iterable<JournalEntry>,EntryProcessorResult<V>> entryProcessor)
throws ServiceException
JournalService
This method does not return entries that were added immediately before
calling this method. Use JournalService.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 JournalServicejournalId - 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
ServiceException - if entries could not be fetched or the journal state could not be saved
public void waitForRecentEntriesToBecomeVisible()
throws InterruptedException
JournalServiceJournalService.processEntries(com.atlassian.confluence.api.model.journal.JournalIdentifier, int, com.google.common.base.Function).
waitForRecentEntriesToBecomeVisible in interface JournalServiceInterruptedException - if the thread got interrupted
public Iterable<JournalEntry> peek(@Nonnull
JournalIdentifier journalId,
int maxEntries)
throws ServiceException
JournalService
peek in interface JournalServicejournalId - only entries with this journal id will be returnedmaxEntries - maximum number of entries to return
ServiceException - if entries could not be fetched
public void reset(@Nonnull
JournalIdentifier journalId)
throws ServiceException
JournalService
reset in interface JournalServicejournalId - identifier of the journal to reset
ServiceException - if the reset fails
public int countEntries(@Nonnull
JournalIdentifier journalId)
throws ServiceException
JournalService
countEntries in interface JournalServicejournalId - identifier of the journal
ServiceException - if entries could not be counted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||