akka.util
Class BoundedBlockingQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by 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.


Constructor Summary
BoundedBlockingQueue(int maxCapacity, java.util.Queue<E> backing)
           
 
Method Summary
 void clear()
           
 boolean contains(java.lang.Object e)
           
 boolean containsAll(java.util.Collection<?> c)
           
 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()
           
 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
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
 

Constructor Detail

BoundedBlockingQueue

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

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>