Package akka.util

Class BoundedBlockingQueue<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>
    Direct Known Subclasses:
    BoundedPriorityMailbox.MessageQueue, BoundedStablePriorityMailbox.MessageQueue

    public class BoundedBlockingQueue<E>
    extends java.util.AbstractQueue<E>
    implements java.util.concurrent.BlockingQueue<E>
    BoundedBlockingQueue wraps any Queue and turns the result into a BlockingQueue with a limited capacity. param: maxCapacity - the maximum capacity of this Queue, needs to be &gt; 0 param: backing - the backing Queue
    • Constructor Summary

      Constructor Description
      BoundedBlockingQueue​(int maxCapacity, java.util.Queue<E> backing)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean contains​(java.lang.Object e)  
      boolean containsAll​(java.util.Collection<?> c)  
      protected java.util.concurrent.locks.ReentrantLock createLock()  
      protected java.util.concurrent.locks.Condition createNotEmptyCondition()  
      protected java.util.concurrent.locks.Condition createNotFullCondition()  
      int drainTo​(java.util.Collection<? super E> c)  
      int drainTo​(java.util.Collection<? super E> c, int maxElements)  
      boolean isEmpty()  
      java.util.Iterator<E> iterator()  
      protected java.util.concurrent.locks.ReentrantLock lock()  
      int maxCapacity()  
      protected java.util.concurrent.locks.Condition notEmpty()  
      protected java.util.concurrent.locks.Condition notFull()  
      boolean offer​(E e)  
      boolean offer​(E e, long timeout, java.util.concurrent.TimeUnit unit)  
      E peek()  
      E poll()  
      E poll​(long timeout, java.util.concurrent.TimeUnit unit)  
      void put​(E e)  
      int remainingCapacity()  
      boolean remove​(java.lang.Object e)  
      boolean removeAll​(java.util.Collection<?> c)  
      boolean retainAll​(java.util.Collection<?> c)  
      int size()  
      E take()  
      java.lang.Object[] toArray()  
      <X> X[] toArray​(X[] a)  
      • Methods inherited from class java.util.AbstractQueue

        add, addAll, element, remove
      • Methods inherited from class java.util.AbstractCollection

      • 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

      • Methods inherited from interface java.util.Collection

        addAll, equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

      • Methods inherited from interface java.util.Queue

        element, remove
    • Constructor Detail

      • BoundedBlockingQueue

        public BoundedBlockingQueue​(int maxCapacity,
                                    java.util.Queue<E> backing)
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
        clear in class java.util.AbstractQueue<E>
      • contains

        public boolean contains​(java.lang.Object e)
        Specified by:
        contains in interface java.util.concurrent.BlockingQueue<E>
        Specified by:
        contains in interface java.util.Collection<E>
        contains in class java.util.AbstractCollection<E>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<E>
        containsAll in class java.util.AbstractCollection<E>
      • createLock

        protected java.util.concurrent.locks.ReentrantLock createLock()
      • createNotEmptyCondition

        protected java.util.concurrent.locks.Condition createNotEmptyCondition()
      • createNotFullCondition

        protected java.util.concurrent.locks.Condition createNotFullCondition()
      • drainTo

        public int drainTo​(java.util.Collection<? super E> c)
        Specified by:
        drainTo in interface java.util.concurrent.BlockingQueue<E>
      • drainTo

        public int drainTo​(java.util.Collection<? super E> c,
                           int maxElements)
        Specified by:
        drainTo in interface java.util.concurrent.BlockingQueue<E>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E>
        isEmpty in class java.util.AbstractCollection<E>
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Specified by:
        iterator in class java.util.AbstractCollection<E>
      • lock

        protected java.util.concurrent.locks.ReentrantLock lock()
      • maxCapacity

        public int maxCapacity()
      • notEmpty

        protected java.util.concurrent.locks.Condition notEmpty()
      • notFull

        protected java.util.concurrent.locks.Condition notFull()
      • offer

        public boolean offer​(E e)
        Specified by:
        offer in interface java.util.concurrent.BlockingQueue<E>
        Specified by:
        offer in interface java.util.Queue<E>
      • offer

        public boolean offer​(E e,
                             long timeout,
                             java.util.concurrent.TimeUnit unit)
        Specified by:
        offer in interface java.util.concurrent.BlockingQueue<E>
      • peek

        public E peek()
        Specified by:
        peek in interface java.util.Queue<E>
      • poll

        public E poll​(long timeout,
                      java.util.concurrent.TimeUnit unit)
        Specified by:
        poll in interface java.util.concurrent.BlockingQueue<E>
      • poll

        public E poll()
        Specified by:
        poll in interface java.util.Queue<E>
      • put

        public void put​(E e)
        Specified by:
        put in interface java.util.concurrent.BlockingQueue<E>
      • remainingCapacity

        public int remainingCapacity()
        Specified by:
        remainingCapacity in interface java.util.concurrent.BlockingQueue<E>
      • remove

        public boolean remove​(java.lang.Object e)
        Specified by:
        remove in interface java.util.concurrent.BlockingQueue<E>
        Specified by:
        remove in interface java.util.Collection<E>
        remove in class java.util.AbstractCollection<E>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<E>
        removeAll in class java.util.AbstractCollection<E>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<E>
        retainAll in class java.util.AbstractCollection<E>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in class java.util.AbstractCollection<E>
      • take

        public E take()
        Specified by:
        take in interface java.util.concurrent.BlockingQueue<E>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<E>
        toArray in class java.util.AbstractCollection<E>
      • toArray

        public <X> X[] toArray​(X[] a)
        Specified by:
        toArray in interface java.util.Collection<E>
        toArray in class java.util.AbstractCollection<E>