Class GrowableMpScArrayConsumerBlockingQueue<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<T>
-
- org.apache.bookkeeper.common.collections.GrowableMpScArrayConsumerBlockingQueue<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.concurrent.BlockingQueue<T>,java.util.Queue<T>
public class GrowableMpScArrayConsumerBlockingQueue<T> extends java.util.AbstractQueue<T> implements java.util.concurrent.BlockingQueue<T>This implements aBlockingQueuebacked by an array with no fixed capacity.When the capacity is reached, data will be moved to a bigger array.
This queue only allows 1 consumer thread to dequeue items and multiple producer threads.
-
-
Constructor Summary
Constructors Constructor Description GrowableMpScArrayConsumerBlockingQueue()GrowableMpScArrayConsumerBlockingQueue(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T e)voidclear()intdrainTo(java.util.Collection<? super T> c)intdrainTo(java.util.Collection<? super T> c, int maxElements)Telement()java.util.Iterator<T>iterator()booleanoffer(T e)booleanoffer(T e, long timeout, java.util.concurrent.TimeUnit unit)Tpeek()Tpoll()Tpoll(long timeout, java.util.concurrent.TimeUnit unit)voidput(T e)intremainingCapacity()Tremove()intsize()Ttake()java.lang.StringtoString()-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
remove
public T remove()
-
element
public T element()
-
offer
public boolean offer(T e)
-
add
public boolean add(T e)
-
offer
public boolean offer(T e, long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
offerin interfacejava.util.concurrent.BlockingQueue<T>
-
take
public T take() throws java.lang.InterruptedException
- Specified by:
takein interfacejava.util.concurrent.BlockingQueue<T>- Throws:
java.lang.InterruptedException
-
poll
public T poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
pollin interfacejava.util.concurrent.BlockingQueue<T>- Throws:
java.lang.InterruptedException
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfacejava.util.concurrent.BlockingQueue<T>
-
drainTo
public int drainTo(java.util.Collection<? super T> c)
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<T>
-
drainTo
public int drainTo(java.util.Collection<? super T> c, int maxElements)
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<T>
-
clear
public void clear()
-
size
public int size()
-
iterator
public java.util.Iterator<T> iterator()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection<T>
-
-