Class GrowableArrayBlockingQueue<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<T>
org.apache.pulsar.common.util.collections.GrowableArrayBlockingQueue<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,BlockingQueue<T>,Queue<T>
This implements a
BlockingQueue backed by an array with no fixed capacity.
When the capacity is reached, data will be moved to a bigger array.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclear()intdrainTo(Collection<? super T> c) intdrainTo(Collection<? super T> c, int maxElements) element()voidbooleaniterator()booleanbooleanpeek()poll()voidintremove()booleanintsize()take()voidMake the queue not accept new items.toList()toString()Methods inherited from class java.util.AbstractQueue
addAllMethods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
containsMethods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
GrowableArrayBlockingQueue
public GrowableArrayBlockingQueue() -
GrowableArrayBlockingQueue
public GrowableArrayBlockingQueue(int initialCapacity)
-
-
Method Details
-
remove
-
poll
-
element
-
peek
-
offer
-
put
- Specified by:
putin interfaceBlockingQueue<T>
-
add
- Specified by:
addin interfaceBlockingQueue<T>- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceQueue<T>- Overrides:
addin classAbstractQueue<T>
-
offer
- Specified by:
offerin interfaceBlockingQueue<T>
-
take
- Specified by:
takein interfaceBlockingQueue<T>- Throws:
InterruptedException
-
poll
- Specified by:
pollin interfaceBlockingQueue<T>- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacityin interfaceBlockingQueue<T>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<T>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>- Overrides:
clearin classAbstractQueue<T>
-
remove
- Specified by:
removein interfaceBlockingQueue<T>- Specified by:
removein interfaceCollection<T>- Overrides:
removein classAbstractCollection<T>
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein classAbstractCollection<T>
-
iterator
- Specified by:
iteratorin interfaceCollection<T>- Specified by:
iteratorin interfaceIterable<T>- Specified by:
iteratorin classAbstractCollection<T>
-
toList
-
forEach
-
toString
- Overrides:
toStringin classAbstractCollection<T>
-
terminate
Make the queue not accept new items. if there are still new data trying to enter the queue, it will be handed by . -
isTerminated
public boolean isTerminated()
-