T - public class DefaultWaterMarkQueue<T> extends Object implements WaterMarkQueue<T>
ArrayBlockingQueue up to water mark. Then it uses a LinkedBlockingQueue or
ArrayBlocking queue from the water mark point. The LinkedBlockingQueue is used if a queue
size is specified other than the waterMark.| Constructor and Description |
|---|
DefaultWaterMarkQueue(int waterMark)
Create a
WaterMarkQueue with a waterMark. |
DefaultWaterMarkQueue(int waterMark,
int size)
Create a
WaterMarkQueue with a waterMark. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> ts) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> objects) |
int |
drainTo(Collection<? super T> objects) |
int |
drainTo(Collection<? super T> objects,
int i) |
T |
element() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
offer(T t) |
boolean |
offer(T t,
long l,
TimeUnit timeUnit) |
boolean |
offerAfter(T t)
Offer the element after the water mark.
|
T |
peek() |
T |
poll() |
T |
poll(long l,
TimeUnit timeUnit) |
void |
put(T t) |
int |
remainingCapacity() |
T |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> objects) |
boolean |
retainAll(Collection<?> objects) |
int |
size() |
T |
take() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] ts) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCodepublic DefaultWaterMarkQueue(int waterMark)
WaterMarkQueue with a waterMark. The queue will first fill up
to waterMark. These items will be inserted in to an ArrayBlockingQueue.
After this an LinkedBlockingQueue will be used without a bound.waterMark - the waterMark of the queuepublic DefaultWaterMarkQueue(int waterMark,
int size)
WaterMarkQueue with a waterMark. The queue will first fill up
to waterMark. These items will be inserted in to an ArrayBlockingQueue.
After this an LinkedBlockingQueue will be used with capacity
size - waterMark.waterMark - the waterMark of the queuesize - the size of the queuepublic boolean add(T t)
add in interface Collection<T>add in interface BlockingQueue<T>add in interface Queue<T>public boolean offer(T t)
public void put(T t) throws InterruptedException
put in interface BlockingQueue<T>InterruptedExceptionpublic boolean offer(T t, long l, TimeUnit timeUnit) throws InterruptedException
offer in interface BlockingQueue<T>InterruptedExceptionpublic T take() throws InterruptedException
take in interface BlockingQueue<T>InterruptedExceptionpublic T poll(long l, TimeUnit timeUnit) throws InterruptedException
poll in interface BlockingQueue<T>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<T>public boolean remove(Object o)
remove in interface Collection<T>remove in interface BlockingQueue<T>public boolean containsAll(Collection<?> objects)
containsAll in interface Collection<T>public boolean addAll(Collection<? extends T> ts)
addAll in interface Collection<T>public boolean removeAll(Collection<?> objects)
removeAll in interface Collection<T>public boolean retainAll(Collection<?> objects)
retainAll in interface Collection<T>public void clear()
clear in interface Collection<T>public int size()
size in interface Collection<T>public boolean isEmpty()
isEmpty in interface Collection<T>public boolean contains(Object o)
contains in interface Collection<T>contains in interface BlockingQueue<T>public Object[] toArray()
toArray in interface Collection<T>public <T> T[] toArray(T[] ts)
toArray in interface Collection<T>public int drainTo(Collection<? super T> objects)
drainTo in interface BlockingQueue<T>public int drainTo(Collection<? super T> objects, int i)
drainTo in interface BlockingQueue<T>public boolean offerAfter(T t)
WaterMarkQueueofferAfter in interface WaterMarkQueue<T>t - object to be insertedCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.