Class AbstractJournalIndexTaskQueue<T extends IndexTask>
- java.lang.Object
- 
- com.atlassian.confluence.internal.search.queue.AbstractJournalIndexTaskQueue<T>
 
- 
- Type Parameters:
- T- type of the index task
 - All Implemented Interfaces:
- IndexTaskQueue<T>
 - Direct Known Subclasses:
- JournalIndexTaskQueue
 
 @Internal public abstract class AbstractJournalIndexTaskQueue<T extends IndexTask> extends Object implements IndexTaskQueue<T> Abstract base class forIndexTaskQueueimplementations that are backed by the journal.Subclass implementations supply the type of IndexTaskthat is queued.Subclass implementations also supply logic to convert from their supplied IndexTasktype to aJournalEntry(and logic for the reverse).- Since:
- 5.9.
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected AnyTypeDaoanyTypeDaostatic JournalIdentifierCHANGE_JOURNAL_IDDeprecated.since 7.9.0.static JournalIdentifierCONTENT_JOURNAL_IDDeprecated.since 7.9.0.protected IndexFlushRequesterindexFlushRequesterprotected JournalIdentifierjournalIdentifierprotected JournalServicejournalService
 - 
Constructor SummaryConstructors Constructor Description AbstractJournalIndexTaskQueue(JournalService journalService, AnyTypeDao anyTypeDao, IndexFlushRequester indexFlushRequester, JournalIdentifier journalIdentifier)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidenqueue(T task)Add a new task to this queue.voidenqueueAll(Collection<T> tasks)Add a collection of tasks to this queue.intflushAndExecute(Consumer<T> action)Flush the contents of the queue, applying the given action to each flushed entry.intflushAndExecute(Consumer<T> action, int numberOfEntries)Flush the contents of the queue, applying the given action to each flushed entry.List<T>flushQueue()Deprecated.List<T>flushQueue(int numberOfEntries)Deprecated.intflushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks)Flush the contents of the queue, applying the given action to an iterable of tasks.JournalIdentifiergetJournalIdentifier()List<T>getQueuedEntries()Retrieve a list of all queued entries.List<T>getQueuedEntries(int limit)Retrieve a list of the N of queued entries.intgetSize()Retrieve the number of elements in the queue.voidreset()Remove all queued index tasks from this queue.protected abstract Optional<JournalEntry>toEntry(T task)Convert a task into a journal entry.protected abstract TtoTask(JournalEntry entry)Convert an entry to a task.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.atlassian.confluence.search.IndexTaskQueueflushQueue, flushQueue
 
- 
 
- 
- 
- 
Field Detail- 
CONTENT_JOURNAL_ID@Deprecated @Internal public static final JournalIdentifier CONTENT_JOURNAL_ID Deprecated.since 7.9.0. Use spring dependency injection to get this instead of reffering static field
 - 
CHANGE_JOURNAL_ID@Deprecated @Internal public static final JournalIdentifier CHANGE_JOURNAL_ID Deprecated.since 7.9.0. Use spring dependency injection to get this instead of reffering static field
 - 
journalServiceprotected final JournalService journalService 
 - 
anyTypeDaoprotected final AnyTypeDao anyTypeDao 
 - 
indexFlushRequesterprotected final IndexFlushRequester indexFlushRequester 
 - 
journalIdentifierprotected final JournalIdentifier journalIdentifier 
 
- 
 - 
Constructor Detail- 
AbstractJournalIndexTaskQueuepublic AbstractJournalIndexTaskQueue(JournalService journalService, AnyTypeDao anyTypeDao, IndexFlushRequester indexFlushRequester, JournalIdentifier journalIdentifier) 
 
- 
 - 
Method Detail- 
toTaskprotected abstract T toTask(JournalEntry entry) Convert an entry to a task.- Parameters:
- entry- a journal entry.
- Returns:
- a task
 
 - 
toEntryprotected abstract Optional<JournalEntry> toEntry(T task) Convert a task into a journal entry.- Parameters:
- task- a task
- Returns:
- a journal entry
 
 - 
getSizepublic int getSize() Description copied from interface:IndexTaskQueueRetrieve the number of elements in the queue.- Specified by:
- getSizein interface- IndexTaskQueue<T extends IndexTask>
- Returns:
- size of the queue.
 
 - 
getQueuedEntriespublic List<T> getQueuedEntries() Description copied from interface:IndexTaskQueueRetrieve a list of all queued entries.- Specified by:
- getQueuedEntriesin interface- IndexTaskQueue<T extends IndexTask>
- Returns:
- a list of IndexTask instances.
 
 - 
getQueuedEntriespublic List<T> getQueuedEntries(int limit) Description copied from interface:IndexTaskQueueRetrieve a list of the N of queued entries.- Specified by:
- getQueuedEntriesin interface- IndexTaskQueue<T extends IndexTask>
- Parameters:
- limit- first N entries to retrieve.
- Returns:
- a list of IndexTask instances.
 
 - 
enqueuepublic void enqueue(T task) Description copied from interface:IndexTaskQueueAdd a new task to this queue.- Specified by:
- enqueuein interface- IndexTaskQueue<T extends IndexTask>
 
 - 
enqueueAllpublic void enqueueAll(Collection<T> tasks) Description copied from interface:IndexTaskQueueAdd a collection of tasks to this queue.- Specified by:
- enqueueAllin interface- IndexTaskQueue<T extends IndexTask>
 
 - 
flushQueue@Deprecated public List<T> flushQueue(int numberOfEntries) Deprecated.Description copied from interface:IndexTaskQueueFlush the contents of the queue, returning those elements currently queued as the result.Tasks that were added immediately before calling this method are not returned. See IndexTaskQueue.flushQueue()for an alternative.- Specified by:
- flushQueuein interface- IndexTaskQueue<T extends IndexTask>
- Parameters:
- numberOfEntries- the maximum number of entries to return. This should return the n first entries in the queue.
- Returns:
- the list of entries on the queue when it was flushed.
 
 - 
flushQueue@Deprecated public List<T> flushQueue() Deprecated.Description copied from interface:IndexTaskQueueFlush the contents of the queue, returning those elements currently queued as the result.This method waits until tasks that we added immediately before calling this method are available. See IndexTaskQueue.flushQueue(int)for an alternative.- Specified by:
- flushQueuein interface- IndexTaskQueue<T extends IndexTask>
- Returns:
- the list of entries on the queue when it was flushed.
 
 - 
flushAndExecutepublic int flushAndExecute(Consumer<T> action) Description copied from interface:IndexTaskQueueFlush the contents of the queue, applying the given action to each flushed entry.This method waits until tasks that we added immediately before calling this method are available. See IndexTaskQueue.flushAndExecute(Consumer, int)for an alternative.- Specified by:
- flushAndExecutein interface- IndexTaskQueue<T extends IndexTask>
- Parameters:
- action- action to perform for each entry
- Returns:
- the number of entries that were flushed.
 
 - 
flushAndExecutepublic int flushAndExecute(Consumer<T> action, int numberOfEntries) Description copied from interface:IndexTaskQueueFlush the contents of the queue, applying the given action to each flushed entry.Tasks that were added immediately before calling this method are not returned. See IndexTaskQueue.flushAndExecute(Consumer)for an alternative.- Specified by:
- flushAndExecutein interface- IndexTaskQueue<T extends IndexTask>
- Parameters:
- action- action to perform for each entry
- numberOfEntries- the maximum number of entries to flush. This should flush the n first entries in the queue.
- Returns:
- the number of entries that were flushed.
 
 - 
flushQueueWithActionOnIterableOfTaskspublic int flushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks) Description copied from interface:IndexTaskQueueFlush the contents of the queue, applying the given action to an iterable of tasks.IndexTaskQueue.flushQueue(Effect, int)applys an action to an individual task. In contrast, this method applies an action to an iterable of tasks.If the specified action throws a RuntimeException, tasks are returned to the queue so that they can be processed again. The exception will be propagated so clients must handle it accordingly. - Specified by:
- flushQueueWithActionOnIterableOfTasksin interface- IndexTaskQueue<T extends IndexTask>
- Parameters:
- actionOnIterableOfTasks- action on iterable of tasks
- numberOfTasks- the maximum number of tasks to retrieve from the queue
- Returns:
- the number of tasks that were flushed to the index.
 
 - 
resetpublic void reset() Description copied from interface:IndexTaskQueueRemove all queued index tasks from this queue.- Specified by:
- resetin interface- IndexTaskQueue<T extends IndexTask>
 
 - 
getJournalIdentifierpublic JournalIdentifier getJournalIdentifier() 
 
- 
 
-