Package org.apache.druid.client.cache
Class BytesBoundedLinkedQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
org.apache.druid.client.cache.BytesBoundedLinkedQueue<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
public abstract class BytesBoundedLinkedQueue<E>
extends AbstractQueue<E>
implements BlockingQueue<E>
Abstract implementation of a BlockingQueue bounded by the size of elements,
works similar to LinkedBlockingQueue except that capacity is bounded by the size in bytes of the elements in the queue.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdrainTo(Collection<? super E> c) intdrainTo(Collection<? super E> c, int maxElements) voidelementAdded(E e) voidelementRemoved(E e) abstract longgetBytesSize(E e) iterator()booleanbooleanpeek()poll()voidintintsize()take()Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
add, contains, removeMethods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
BytesBoundedLinkedQueue
public BytesBoundedLinkedQueue(long capacity)
-
-
Method Details
-
getBytesSize
-
elementAdded
-
elementRemoved
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
put
- Specified by:
putin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
offer
- Specified by:
offerin 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>
-
offer
-
poll
-
poll
- Specified by:
pollin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
peek
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-