akka.util
Class BoundedBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
akka.util.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
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 > 0
param: backing - the backing Queue
Methods inherited from class java.util.AbstractQueue |
add, addAll, element, remove |
Methods inherited from class java.util.AbstractCollection |
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 |
Methods inherited from interface java.util.Queue |
element, remove |
Methods inherited from interface java.util.Collection |
addAll, equals, hashCode |
BoundedBlockingQueue
public BoundedBlockingQueue(int maxCapacity,
java.util.Queue<E> backing)
maxCapacity
public int maxCapacity()
lock
protected java.util.concurrent.locks.ReentrantLock lock()
put
public void put(E e)
- Specified by:
put
in interface java.util.concurrent.BlockingQueue<E>
take
public E take()
- Specified by:
take
in interface java.util.concurrent.BlockingQueue<E>
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>
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>
remove
public boolean remove(java.lang.Object e)
- Specified by:
remove
in interface java.util.Collection<E>
- Specified by:
remove
in interface java.util.concurrent.BlockingQueue<E>
- Overrides:
remove
in class java.util.AbstractCollection<E>
contains
public boolean contains(java.lang.Object e)
- Specified by:
contains
in interface java.util.Collection<E>
- Specified by:
contains
in interface java.util.concurrent.BlockingQueue<E>
- Overrides:
contains
in class java.util.AbstractCollection<E>
clear
public void clear()
- Specified by:
clear
in interface java.util.Collection<E>
- Overrides:
clear
in class java.util.AbstractQueue<E>
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interface java.util.concurrent.BlockingQueue<E>
size
public int size()
- Specified by:
size
in interface java.util.Collection<E>
- Specified by:
size
in class java.util.AbstractCollection<E>
peek
public E peek()
- Specified by:
peek
in interface java.util.Queue<E>
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>
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interface java.util.Collection<E>
- Overrides:
containsAll
in class java.util.AbstractCollection<E>
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interface java.util.Collection<E>
- Overrides:
removeAll
in class java.util.AbstractCollection<E>
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interface java.util.Collection<E>
- Overrides:
retainAll
in class java.util.AbstractCollection<E>
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<E>
- Specified by:
iterator
in interface java.util.Collection<E>
- Specified by:
iterator
in class java.util.AbstractCollection<E>
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interface java.util.Collection<E>
- Overrides:
toArray
in class java.util.AbstractCollection<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Collection<E>
- Overrides:
isEmpty
in class java.util.AbstractCollection<E>
toArray
public <X> X[] toArray(X[] a)
- Specified by:
toArray
in interface java.util.Collection<E>
- Overrides:
toArray
in class java.util.AbstractCollection<E>