Package 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
,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 > 0 param: backing - the backing Queue
-
-
Constructor Summary
Constructors 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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
BoundedBlockingQueue
public BoundedBlockingQueue(int maxCapacity, java.util.Queue<E> backing)
-
-
Method Detail
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object e)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
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 interfacejava.util.concurrent.BlockingQueue<E>
-
drainTo
public int drainTo(java.util.Collection<? super E> c, int maxElements)
- Specified by:
drainTo
in interfacejava.util.concurrent.BlockingQueue<E>
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<E> iterator()
-
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)
-
offer
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
offer
in interfacejava.util.concurrent.BlockingQueue<E>
-
poll
public E poll(long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
poll
in interfacejava.util.concurrent.BlockingQueue<E>
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interfacejava.util.concurrent.BlockingQueue<E>
-
remove
public boolean remove(java.lang.Object e)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
size
public int size()
-
toArray
public java.lang.Object[] toArray()
-
-