T - public class DefaultWaterMarkQueue<T> extends java.lang.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(java.util.Collection<? extends T> ts) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> objects) |
int |
drainTo(java.util.Collection<? super T> objects) |
int |
drainTo(java.util.Collection<? super T> objects,
int i) |
T |
element() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
offer(T t) |
boolean |
offer(T t,
long l,
java.util.concurrent.TimeUnit timeUnit) |
boolean |
offerAfter(T t)
Offer the element after the water mark.
|
T |
peek() |
T |
poll() |
T |
poll(long l,
java.util.concurrent.TimeUnit timeUnit) |
void |
put(T t) |
int |
remainingCapacity() |
T |
remove() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> objects) |
boolean |
retainAll(java.util.Collection<?> objects) |
int |
size() |
T |
take() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] ts) |
public 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)
public boolean offer(T t)
public void put(T t) throws java.lang.InterruptedException
put in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic boolean offer(T t, long l, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
offer in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic T take() throws java.lang.InterruptedException
take in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic T poll(long l, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
poll in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface java.util.concurrent.BlockingQueue<T>public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> objects)
containsAll in interface java.util.Collection<T>public boolean addAll(java.util.Collection<? extends T> ts)
addAll in interface java.util.Collection<T>public boolean removeAll(java.util.Collection<?> objects)
removeAll in interface java.util.Collection<T>public boolean retainAll(java.util.Collection<?> objects)
retainAll in interface java.util.Collection<T>public void clear()
clear in interface java.util.Collection<T>public int size()
size in interface java.util.Collection<T>public boolean isEmpty()
isEmpty in interface java.util.Collection<T>public boolean contains(java.lang.Object o)
public java.util.Iterator<T> iterator()
public java.lang.Object[] toArray()
toArray in interface java.util.Collection<T>public <T> T[] toArray(T[] ts)
toArray in interface java.util.Collection<T>public int drainTo(java.util.Collection<? super T> objects)
drainTo in interface java.util.concurrent.BlockingQueue<T>public int drainTo(java.util.Collection<? super T> objects, int i)
drainTo in interface java.util.concurrent.BlockingQueue<T>public boolean offerAfter(T t)
WaterMarkQueueofferAfter in interface WaterMarkQueue<T>t - object to be insertedCopyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.