public class AvlQueue
extends java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>
Extended ArrayBlockingQueue class so that don't have to create a blocking queue from scratch.
Note: wanted to extend from ArrayBlockingQueue
| Constructor and Description |
|---|
AvlQueue(int queueSize)
Constructs the queue to have specified size.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Runnable runnable)
Calls superclass add() method but also updates the AVL data per vehicle
map.
|
boolean |
offer(java.lang.Runnable runnable)
Calls superclass offer() method but also updates the AVL data per vehicle
map.
|
boolean |
offer(java.lang.Runnable runnable,
long timeout,
java.util.concurrent.TimeUnit unit)
Calls superclass offer(timeout, unit) method but also updates the AVL
data per vehicle map.
|
java.lang.Runnable |
poll()
Calls superclass poll() method until it gets AVL data that is not
obsolete.
|
java.lang.Runnable |
poll(long timeout,
java.util.concurrent.TimeUnit unit)
Calls superclass poll(timeout, unit) method until it gets AVL data that
is not obsolete.
|
void |
put(java.lang.Runnable runnable)
Calls superclass add() method but also updates the AVL data per vehicle
map.
|
java.lang.Runnable |
take()
Calls superclass take() method until it gets AVL data that is not
obsolete.
|
clear, contains, drainTo, drainTo, iterator, peek, remainingCapacity, remove, size, spliterator, toArray, toArray, toStringcontainsAll, isEmpty, removeAll, retainAllequals, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic AvlQueue(int queueSize)
queueSize - How many AVL elements can be put into the queue before it
blocks.public boolean add(java.lang.Runnable runnable)
add in interface java.util.Collection<java.lang.Runnable>add in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>add in interface java.util.Queue<java.lang.Runnable>add in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>public void put(java.lang.Runnable runnable)
throws java.lang.InterruptedException
put in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>put in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>java.lang.InterruptedExceptionpublic boolean offer(java.lang.Runnable runnable)
offer in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>offer in interface java.util.Queue<java.lang.Runnable>offer in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>public boolean offer(java.lang.Runnable runnable,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
offer in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>offer in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>java.lang.InterruptedExceptionpublic java.lang.Runnable poll()
poll in interface java.util.Queue<java.lang.Runnable>poll in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>public java.lang.Runnable poll(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
poll in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>poll in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>java.lang.InterruptedExceptionpublic java.lang.Runnable take()
throws java.lang.InterruptedException
take in interface java.util.concurrent.BlockingQueue<java.lang.Runnable>take in class java.util.concurrent.ArrayBlockingQueue<java.lang.Runnable>java.lang.InterruptedException