org.apache.oozie.util
Class PollablePriorityDelayQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<PriorityDelayQueue.QueueElement<E>>
org.apache.oozie.util.PriorityDelayQueue<E>
org.apache.oozie.util.PollablePriorityDelayQueue<E>
- All Implemented Interfaces:
- Iterable<PriorityDelayQueue.QueueElement<E>>, Collection<PriorityDelayQueue.QueueElement<E>>, BlockingQueue<PriorityDelayQueue.QueueElement<E>>, Queue<PriorityDelayQueue.QueueElement<E>>
public class PollablePriorityDelayQueue<E>
- extends PriorityDelayQueue<E>
Methods inherited from class org.apache.oozie.util.PriorityDelayQueue |
add, antiStarvation, clear, debug, drainTo, drainTo, getMaxSize, getMaxWait, getPriorities, iterator, offer, offer, peek, poll, put, remainingCapacity, size, sizes, take |
PollablePriorityDelayQueue
public PollablePriorityDelayQueue(int priorities,
long maxWait,
TimeUnit unit,
int maxSize)
poll
public PriorityDelayQueue.QueueElement<E> poll()
- Retrieve and remove the head of this queue if it is eligible to poll. If not, iterate next element until find
the one which is eligible to poll from queue.
Return null if this queue has no elements eligible to run.
Invocations to this method run the anti-starvation (once every interval check).
- Specified by:
poll
in interface Queue<PriorityDelayQueue.QueueElement<E>>
- Overrides:
poll
in class PriorityDelayQueue<E>
- Returns:
- the element of this queue, for which eligibleToPoll is true.
eligibleToPoll
protected boolean eligibleToPoll(PriorityDelayQueue.QueueElement<?> element)
- Method for checking the QueueElement eligible to poll before remove it from queue.
This method should be overriden for checking purposes.
- Parameters:
element
- the element to check
Copyright © 2013 Apache Software Foundation. All Rights Reserved.