Module org.elasticsearch.server
Class SizeBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
org.elasticsearch.common.util.concurrent.SizeBlockingQueue<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
A size based queue wrapping another blocking queue to provide (somewhat relaxed) capacity checks.
Mainly makes sense to use with blocking queues that are unbounded to provide the ability to do
capacity verification.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()booleanbooleancontainsAll(Collection<?> c) intdrainTo(Collection<? super E> c) intdrainTo(Collection<? super E> c, int maxElements) voidForces adding an element to the queue, without doing size checks.iterator()booleanbooleanpeek()poll()voidintbooleanintsize()take()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.util.AbstractCollection
isEmpty, removeAll, retainAll, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
addMethods inherited from interface java.util.Collection
addAll, clear, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray
-
Constructor Details
-
SizeBlockingQueue
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
capacity
public int capacity() -
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-
peek
-
poll
-
poll
- Specified by:
pollin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
remove
- Specified by:
removein interfaceBlockingQueue<E>- Specified by:
removein interfaceCollection<E>- Overrides:
removein classAbstractCollection<E>
-
forcePut
Forces adding an element to the queue, without doing size checks.- Throws:
InterruptedException
-
offer
-
offer
- Specified by:
offerin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
put
- Specified by:
putin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
take
- Specified by:
takein interfaceBlockingQueue<E>- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacityin interfaceBlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-
toArray
- Specified by:
toArrayin interfaceCollection<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<E>- Overrides:
toArrayin classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceBlockingQueue<E>- Specified by:
containsin interfaceCollection<E>- Overrides:
containsin classAbstractCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Overrides:
containsAllin classAbstractCollection<E>
-