net.sf.jbaobab.expirable
Class ExpirableBlockingQueue<E>

java.lang.Object
  extended by net.sf.jbaobab.expirable.AbstractExpirableCollection<E>
      extended by net.sf.jbaobab.expirable.ExpirableCollection<E>
          extended by net.sf.jbaobab.expirable.ExpirableQueue<E>
              extended by net.sf.jbaobab.expirable.ExpirableBlockingQueue<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

public class ExpirableBlockingQueue<E>
extends ExpirableQueue<E>
implements BlockingQueue<E>

An expirable decorator for a BlockingQueue.

Author:
Oakyoon Cha

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jbaobab.expirable.ExpirableCollection
ExpirableCollection.InternalRemoverImpl<E>
 
Field Summary
 
Fields inherited from class net.sf.jbaobab.expirable.AbstractExpirableCollection
expirer, remover, timeout
 
Constructor Summary
ExpirableBlockingQueue(BlockingQueue<E> queue)
           
ExpirableBlockingQueue(BlockingQueue<E> queue, long timeout)
           
 
Method Summary
 int drainTo(Collection<? super E> collection)
           
 int drainTo(Collection<? super E> collection, int maxElements)
           
 boolean offer(E element, long timeout, TimeUnit unit)
           
 E poll(long timeout, TimeUnit unit)
           
 void put(E element)
           
 void put(E element, long timeout)
           
 int remainingCapacity()
           
 E take()
           
 
Methods inherited from class net.sf.jbaobab.expirable.ExpirableQueue
element, offer, peek, poll, remove
 
Methods inherited from class net.sf.jbaobab.expirable.ExpirableCollection
add, add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class net.sf.jbaobab.expirable.AbstractExpirableCollection
finalize, getHandler, setHandler, timeout, timeout
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.BlockingQueue
add, offer
 
Methods inherited from interface java.util.Queue
element, peek, poll, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

ExpirableBlockingQueue

public ExpirableBlockingQueue(BlockingQueue<E> queue,
                              long timeout)

ExpirableBlockingQueue

public ExpirableBlockingQueue(BlockingQueue<E> queue)
Method Detail

put

public void put(E element,
                long timeout)
         throws InterruptedException
Throws:
InterruptedException

put

public void put(E element)
         throws InterruptedException
Specified by:
put in interface BlockingQueue<E>
Throws:
InterruptedException

offer

public boolean offer(E element,
                     long timeout,
                     TimeUnit unit)
              throws InterruptedException
Specified by:
offer in interface BlockingQueue<E>
Throws:
InterruptedException

poll

public E poll(long timeout,
              TimeUnit unit)
       throws InterruptedException
Specified by:
poll in interface BlockingQueue<E>
Throws:
InterruptedException

take

public E take()
       throws InterruptedException
Specified by:
take in interface BlockingQueue<E>
Throws:
InterruptedException

remainingCapacity

public int remainingCapacity()
Specified by:
remainingCapacity in interface BlockingQueue<E>

drainTo

public int drainTo(Collection<? super E> collection)
Specified by:
drainTo in interface BlockingQueue<E>

drainTo

public int drainTo(Collection<? super E> collection,
                   int maxElements)
Specified by:
drainTo in interface BlockingQueue<E>