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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
clear()
int
drainTo
(Collection<? super T> c) int
drainTo
(Collection<? super T> c, int maxElements) element()
void
boolean
iterator()
boolean
boolean
peek()
poll()
void
int
remove()
boolean
int
size()
take()
void
Make the queue not accept new items.toList()
toString()
Methods inherited from class java.util.AbstractQueue
addAll
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.BlockingQueue
contains
Methods 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:
put
in interfaceBlockingQueue<T>
-
add
- Specified by:
add
in interfaceBlockingQueue<T>
- Specified by:
add
in interfaceCollection<T>
- Specified by:
add
in interfaceQueue<T>
- Overrides:
add
in classAbstractQueue<T>
-
offer
- Specified by:
offer
in interfaceBlockingQueue<T>
-
take
- Specified by:
take
in interfaceBlockingQueue<T>
- Throws:
InterruptedException
-
poll
- Specified by:
poll
in interfaceBlockingQueue<T>
- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacity
in interfaceBlockingQueue<T>
-
drainTo
- Specified by:
drainTo
in interfaceBlockingQueue<T>
-
drainTo
- Specified by:
drainTo
in interfaceBlockingQueue<T>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<T>
- Overrides:
clear
in classAbstractQueue<T>
-
remove
- Specified by:
remove
in interfaceBlockingQueue<T>
- Specified by:
remove
in interfaceCollection<T>
- Overrides:
remove
in classAbstractCollection<T>
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in classAbstractCollection<T>
-
iterator
- Specified by:
iterator
in interfaceCollection<T>
- Specified by:
iterator
in interfaceIterable<T>
- Specified by:
iterator
in classAbstractCollection<T>
-
toList
-
forEach
-
toString
- Overrides:
toString
in 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()
-