@NotThreadSafe public class InMemoryIndexTaskQueue<T extends IndexTask> extends Object implements IndexTaskQueue<T>
Constructor and Description |
---|
InMemoryIndexTaskQueue() |
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.
|
List<T> |
flushQueue()
Flush the contents of the queue, returning those elements currently queued as the result.
|
int |
flushQueue(com.atlassian.fugue.Effect<T> action)
Deprecated.
since 7.0.1. Use
IndexTaskQueue.flushAndExecute(Consumer) |
int |
flushQueue(com.atlassian.fugue.Effect<T> action,
int numberOfEntries)
Deprecated.
since 7.0.1. Use
IndexTaskQueue.flushAndExecute(Consumer, int) |
List<T> |
flushQueue(int numberOfEntries)
Returns ALL entries in the queue.
|
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.
|
List<T> |
getQueuedEntries(int size) |
int |
getSize()
Retrieve the number of elements in the queue.
|
void |
reset()
Remove all queued index tasks from this queue.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flushAndExecute, flushAndExecute
public int getSize()
IndexTaskQueue
getSize
in interface IndexTaskQueue<T extends IndexTask>
public List<T> getQueuedEntries()
IndexTaskQueue
getQueuedEntries
in interface IndexTaskQueue<T extends IndexTask>
public void enqueue(T task)
IndexTaskQueue
enqueue
in interface IndexTaskQueue<T extends IndexTask>
public void enqueueAll(Collection<T> tasks)
IndexTaskQueue
enqueueAll
in interface IndexTaskQueue<T extends IndexTask>
public List<T> flushQueue(int numberOfEntries)
flushQueue
in interface IndexTaskQueue<T extends IndexTask>
numberOfEntries
- the maximum number of entries to return. This should return the n first entries in the queue.public void reset()
IndexTaskQueue
reset
in interface IndexTaskQueue<T extends IndexTask>
public List<T> flushQueue()
IndexTaskQueue
This method waits until tasks that we added immediately before calling
this method are available. See IndexTaskQueue.flushQueue(int)
for an
alternative.
flushQueue
in interface IndexTaskQueue<T extends IndexTask>
@Deprecated public int flushQueue(com.atlassian.fugue.Effect<T> action)
IndexTaskQueue.flushAndExecute(Consumer)
IndexTaskQueue
This method waits until tasks that we added immediately before calling
this method are available. See
IndexTaskQueue.flushAndExecute(Consumer, int)
for an alternative.
flushQueue
in interface IndexTaskQueue<T extends IndexTask>
action
- action to perform for each entry@Deprecated public int flushQueue(com.atlassian.fugue.Effect<T> action, int numberOfEntries)
IndexTaskQueue.flushAndExecute(Consumer, int)
IndexTaskQueue
Tasks that were added immediately before calling this method are not
returned. See IndexTaskQueue.flushAndExecute(Consumer)
for an
alternative.
flushQueue
in interface IndexTaskQueue<T extends IndexTask>
action
- action to perform for each entrynumberOfEntries
- the maximum number of entries to flush. This
should flush the n first entries in the queue.public int flushQueueWithActionOnIterableOfTasks(Consumer<Iterable<T>> actionOnIterableOfTasks, int numberOfTasks)
IndexTaskQueue
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.
flushQueueWithActionOnIterableOfTasks
in interface IndexTaskQueue<T extends IndexTask>
actionOnIterableOfTasks
- action on iterable of tasksnumberOfTasks
- the maximum number of tasks to retrieve from the queueCopyright © 2003–2020 Atlassian. All rights reserved.