org.terracotta.collections
Class ConcurrentBlockingQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by org.terracotta.collections.ConcurrentBlockingQueue<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

public class ConcurrentBlockingQueue<E>
extends AbstractQueue<E>
implements BlockingQueue<E>, Serializable

See Also:
Serialized Form

Constructor Summary
ConcurrentBlockingQueue()
          Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE.
ConcurrentBlockingQueue(Collection<? extends E> c)
          Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE, initially containing the elements of the given collection, added in traversal order of the collection's iterator.
ConcurrentBlockingQueue(int capacity)
          Creates a LinkedBlockingQueue with the given (fixed) capacity.
 
Method Summary
 void __tc_put(E o)
           
 E __tc_take()
           
 void clear()
           
 int drainTo(Collection<? super E> c)
           
 int drainTo(Collection<? super E> c, int maxElements)
           
 int getCapacity()
          Returns the maximum capacity of this queue.
protected  void init()
           
 Iterator<E> iterator()
           
 boolean offer(E o)
           
 boolean offer(E o, long timeout, TimeUnit unit)
           
 E peek()
           
 E poll()
           
 E poll(long timeout, TimeUnit unit)
           
 void put(E o)
           
 int remainingCapacity()
           
 boolean remove(Object o)
           
 int size()
           
 E take()
           
 
Methods inherited from class java.util.AbstractQueue
add, addAll, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, 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, contains
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ConcurrentBlockingQueue

public ConcurrentBlockingQueue()
Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE.


ConcurrentBlockingQueue

public ConcurrentBlockingQueue(int capacity)
Creates a LinkedBlockingQueue with the given (fixed) capacity.

Parameters:
capacity - the capacity of this queue.
Throws:
IllegalArgumentException - if capacity is not greater than zero.

ConcurrentBlockingQueue

public ConcurrentBlockingQueue(Collection<? extends E> c)
Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE, initially containing the elements of the given collection, added in traversal order of the collection's iterator.

Parameters:
c - the collection of elements to initially contain
Throws:
NullPointerException - if c or any element within it is null
Method Detail

init

protected void init()

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in class AbstractCollection<E>

remainingCapacity

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

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in class AbstractCollection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface BlockingQueue<E>
Overrides:
remove in class AbstractCollection<E>

peek

public E peek()
Specified by:
peek in interface Queue<E>

offer

public boolean offer(E o)
Specified by:
offer in interface BlockingQueue<E>
Specified by:
offer in interface Queue<E>

offer

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

put

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

__tc_take

public E __tc_take()

__tc_put

public void __tc_put(E o)

take

public E take()
       throws InterruptedException
Specified by:
take 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

poll

public E poll()
Specified by:
poll in interface Queue<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Overrides:
clear in class AbstractQueue<E>

drainTo

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

drainTo

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

getCapacity

public int getCapacity()
Returns the maximum capacity of this queue.

Returns:
the queue capacity


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.