Interface IndexTaskQueue<T extends IndexTask>
-
- All Known Implementing Classes:
AbstractJournalIndexTaskQueue
,ChangeIndexTaskQueue
,CompositeIndexTaskQueue
,ContentIndexTaskQueue
,InMemoryIndexTaskQueue
,JournalIndexTaskQueue
public interface IndexTaskQueue<T extends IndexTask>
Confluence queues all of its index requests and then executes them in bulk. The indexTaskQueue is there to assist in the queueing the tasks until they are ready to be processed.- Since:
- 5.10
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
enqueue(T task)
Add a new task to this queue.void
enqueueAll(Collection<T> tasks)
Add a collection of tasks to this queue.int
flushAndExecute(Consumer<T> actionOnTask)
Flush the contents of the queue, applying the given action to each flushed entry.int
flushAndExecute(Consumer<T> actionOnTask, int numberOfEntries)
Flush the contents of the queue, applying the given action to each flushed entry.List<T>
flushQueue()
Deprecated.Since 5.6.List<T>
flushQueue(int numberOfEntries)
Deprecated.Since 5.6.default int
flushQueue(com.atlassian.fugue.Effect<T> actionOnTask)
Deprecated.since 7.0.1.default int
flushQueue(com.atlassian.fugue.Effect<T> actionOnTask, int numberOfEntries)
Deprecated.since 7.0.1.int
flushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks)
Flush the contents of the queue, applying the given action to an iterable of tasks.List<T>
getQueuedEntries()
Retrieve a list of all queued entries.List<T>
getQueuedEntries(int limit)
Retrieve a list of the N of queued entries.int
getSize()
Retrieve the number of elements in the queue.void
reset()
Remove all queued index tasks from this queue.
-
-
-
Method Detail
-
getSize
int getSize()
Retrieve the number of elements in the queue.- Returns:
- size of the queue.
-
getQueuedEntries
List<T> getQueuedEntries()
Retrieve a list of all queued entries.- Returns:
- a list of IndexTask instances.
-
getQueuedEntries
List<T> getQueuedEntries(int limit)
Retrieve a list of the N of queued entries.- Parameters:
limit
- first N entries to retrieve.- Returns:
- a list of IndexTask instances.
-
enqueue
void enqueue(T task)
Add a new task to this queue.- Parameters:
task
-
-
enqueueAll
void enqueueAll(Collection<T> tasks)
Add a collection of tasks to this queue.- Parameters:
tasks
-
-
flushQueue
@Deprecated List<T> flushQueue(int numberOfEntries)
Deprecated.Since 5.6. UseflushQueue(com.atlassian.fugue.Effect, int)
instead.Flush 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
flushQueue()
for an alternative.- 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 List<T> flushQueue()
Deprecated.Since 5.6. UseflushQueue(com.atlassian.fugue.Effect, int)
instead.Flush 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
flushQueue(int)
for an alternative.- Returns:
- the list of entries on the queue when it was flushed.
-
flushQueue
@Deprecated default int flushQueue(com.atlassian.fugue.Effect<T> actionOnTask)
Deprecated.since 7.0.1. UseflushAndExecute(Consumer)
Flush 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
flushAndExecute(Consumer, int)
for an alternative.- Parameters:
actionOnTask
- action to perform for each entry- Returns:
- the number of entries that were flushed.
- Since:
- 5.6
-
flushAndExecute
int flushAndExecute(Consumer<T> actionOnTask)
Flush 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
flushAndExecute(Consumer, int)
for an alternative.- Parameters:
actionOnTask
- action to perform for each entry- Returns:
- the number of entries that were flushed.
- Since:
- 7.0.1
-
flushQueue
@Deprecated default int flushQueue(com.atlassian.fugue.Effect<T> actionOnTask, int numberOfEntries)
Deprecated.since 7.0.1. UseflushAndExecute(Consumer, int)
Flush 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
flushAndExecute(Consumer)
for an alternative.- Parameters:
actionOnTask
- action to perform for each entrynumberOfEntries
- 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.
- Since:
- 5.6
-
flushAndExecute
int flushAndExecute(Consumer<T> actionOnTask, int numberOfEntries)
Flush 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
flushAndExecute(Consumer)
for an alternative.- Parameters:
actionOnTask
- action to perform for each entrynumberOfEntries
- 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.
- Since:
- 7.0.1
-
flushQueueWithActionOnIterableOfTasks
@Experimental int flushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks)
Flush the contents of the queue, applying the given action to an iterable of tasks.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.
- Parameters:
actionOnIterableOfTasks
- action on iterable of tasksnumberOfTasks
- the maximum number of tasks to retrieve from the queue- Returns:
- the number of tasks that were flushed to the index.
- Since:
- 5.9
-
reset
void reset()
Remove all queued index tasks from this queue.
-
-