public class DependencyPriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
extends PriorityBlockingQueue<E>
PriorityBlockingQueue
while simultaneously supporting task dependencies using the Dependency
interface.
An independent worker is guaranteed to complete before the dependent worker that specifies it.
Priorities are specified by the worker extending the Priority
class.
When Priorities and Dependencies conflict, the expectation in a dependency chain is that the
entire chain will run at the priority specified by the independent worker.
No effort is made to guarantee all dependencies are satisfied. Responsibility falls on outside
components to validate the dependency graph for complete execution.Constructor and Description |
---|
DependencyPriorityBlockingQueue() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
contains(Object o) |
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
E |
peek() |
E |
poll() |
E |
poll(long timeout,
TimeUnit unit) |
void |
recycleBlockedQueue()
Removes all items from blocked Queue and inserts into primary queue to retry.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> collection) |
int |
size() |
E |
take() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
add, comparator, iterator, offer, offer, put, remainingCapacity, toString
public E take() throws InterruptedException
take
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
take
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
InterruptedException
public E peek()
peek
in interface Queue<E extends Dependency & Task & PriorityProvider>
peek
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public E poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
poll
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
InterruptedException
public E poll()
poll
in interface Queue<E extends Dependency & Task & PriorityProvider>
poll
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public int size()
size
in interface Collection<E extends Dependency & Task & PriorityProvider>
size
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<E extends Dependency & Task & PriorityProvider>
toArray
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public Object[] toArray()
toArray
in interface Collection<E extends Dependency & Task & PriorityProvider>
toArray
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public int drainTo(Collection<? super E> c)
drainTo
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
drainTo
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public int drainTo(Collection<? super E> c, int maxElements)
drainTo
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
drainTo
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public boolean contains(Object o)
contains
in interface Collection<E extends Dependency & Task & PriorityProvider>
contains
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
contains
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public void clear()
clear
in interface Collection<E extends Dependency & Task & PriorityProvider>
clear
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public boolean remove(Object o)
remove
in interface Collection<E extends Dependency & Task & PriorityProvider>
remove
in interface BlockingQueue<E extends Dependency & Task & PriorityProvider>
remove
in class PriorityBlockingQueue<E extends Dependency & Task & PriorityProvider>
public boolean removeAll(Collection<?> collection)
removeAll
in interface Collection<E extends Dependency & Task & PriorityProvider>
removeAll
in class AbstractCollection<E extends Dependency & Task & PriorityProvider>
public void recycleBlockedQueue()