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 aBlockingQueue
backed 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 boolean
add(T e)
void
clear()
int
drainTo(java.util.Collection<? super T> c)
int
drainTo(java.util.Collection<? super T> c, int maxElements)
T
element()
java.util.Iterator<T>
iterator()
boolean
offer(T e)
boolean
offer(T e, long timeout, java.util.concurrent.TimeUnit unit)
T
peek()
T
poll()
T
poll(long timeout, java.util.concurrent.TimeUnit unit)
void
put(T e)
int
remainingCapacity()
T
remove()
int
size()
T
take()
java.lang.String
toString()
-
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:
offer
in interfacejava.util.concurrent.BlockingQueue<T>
-
take
public T take() throws java.lang.InterruptedException
- Specified by:
take
in 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:
poll
in interfacejava.util.concurrent.BlockingQueue<T>
- Throws:
java.lang.InterruptedException
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interfacejava.util.concurrent.BlockingQueue<T>
-
drainTo
public int drainTo(java.util.Collection<? super T> c)
- Specified by:
drainTo
in interfacejava.util.concurrent.BlockingQueue<T>
-
drainTo
public int drainTo(java.util.Collection<? super T> c, int maxElements)
- Specified by:
drainTo
in 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:
toString
in classjava.util.AbstractCollection<T>
-
-