public interface IndexTaskQueue<T extends IndexTask>
Modifier and Type | Method and 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.
|
default int |
flushAndExecute(Consumer<T> actionOnTask)
Flush the contents of the queue, applying the given action to each
flushed entry.
|
default 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. Use
flushQueue(com.atlassian.fugue.Effect, int) instead. |
int |
flushQueue(com.atlassian.fugue.Effect<T> actionOnTask)
Deprecated.
since 7.0.1. Use
flushAndExecute(Consumer) |
int |
flushQueue(com.atlassian.fugue.Effect<T> actionOnTask,
int numberOfEntries)
Deprecated.
since 7.0.1. Use
flushAndExecute(Consumer, int) |
List<T> |
flushQueue(int numberOfEntries)
Deprecated.
Since 5.6. Use
flushQueue(com.atlassian.fugue.Effect, int) instead. |
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 of the queued entries.
|
int |
getSize()
Retrieve the number of elements in the queue.
|
void |
reset()
Remove all queued index tasks from this queue.
|
int getSize()
List<T> getQueuedEntries()
void enqueue(T task)
task
- void enqueueAll(Collection<T> tasks)
tasks
- @Deprecated List<T> flushQueue(int numberOfEntries)
flushQueue(com.atlassian.fugue.Effect, int)
instead.
Tasks that were added immediately before calling this method are not
returned. See flushQueue()
for an alternative.
numberOfEntries
- the maximum number of entries to return. This should return the n first entries in the queue.@Deprecated List<T> flushQueue()
flushQueue(com.atlassian.fugue.Effect, int)
instead.
This method waits until tasks that we added immediately before calling
this method are available. See flushQueue(int)
for an
alternative.
@Deprecated int flushQueue(com.atlassian.fugue.Effect<T> actionOnTask)
flushAndExecute(Consumer)
This method waits until tasks that we added immediately before calling
this method are available. See
flushAndExecute(Consumer, int)
for an alternative.
actionOnTask
- action to perform for each entrydefault int flushAndExecute(Consumer<T> actionOnTask)
This method waits until tasks that we added immediately before calling
this method are available. See
flushAndExecute(Consumer, int)
for an alternative.
actionOnTask
- action to perform for each entry@Deprecated int flushQueue(com.atlassian.fugue.Effect<T> actionOnTask, int numberOfEntries)
flushAndExecute(Consumer, int)
Tasks that were added immediately before calling this method are not
returned. See flushAndExecute(Consumer)
for an
alternative.
actionOnTask
- action to perform for each entrynumberOfEntries
- the maximum number of entries to flush. This
should flush the n first entries in the queue.default int flushAndExecute(Consumer<T> actionOnTask, int numberOfEntries)
Tasks that were added immediately before calling this method are not
returned. See flushAndExecute(Consumer)
for an
alternative.
actionOnTask
- action to perform for each entrynumberOfEntries
- the maximum number of entries to flush. This
should flush the n first entries in the queue.@Experimental int flushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks)
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.
actionOnIterableOfTasks
- action on iterable of tasksnumberOfTasks
- the maximum number of tasks to retrieve from the queuevoid reset()
Copyright © 2003–2020 Atlassian. All rights reserved.