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 Constructor Description BytesBoundedLinkedQueue(long capacity)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intdrainTo(Collection<? super E> c)intdrainTo(Collection<? super E> c, int maxElements)voidelementAdded(E e)voidelementRemoved(E e)abstract longgetBytesSize(E e)Iterator<E>iterator()booleanoffer(E e)booleanoffer(E e, long timeout, TimeUnit unit)Epeek()Epoll()Epoll(long timeout, TimeUnit unit)voidput(E e)intremainingCapacity()intsize()Etake()-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
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
add, contains, remove
-
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Method Detail
-
getBytesSize
public abstract long getBytesSize(E e)
-
elementAdded
public void elementAdded(E e)
-
elementRemoved
public void elementRemoved(E e)
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
put
public void put(E e) throws InterruptedException
- Specified by:
putin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
offer
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
offerin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
take
public E take() throws InterruptedException
- Specified by:
takein interfaceBlockingQueue<E>- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfaceBlockingQueue<E>
-
drainTo
public int drainTo(Collection<? super E> c)
- Specified by:
drainToin interfaceBlockingQueue<E>
-
drainTo
public int drainTo(Collection<? super E> c, int maxElements)
- Specified by:
drainToin interfaceBlockingQueue<E>
-
offer
public boolean offer(E e)
-
poll
public E poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
-