API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. SynchronousQueue View Source
Author(s)
Doug Lea and Bill Scherer and Michael Scott
Since
1.5
Version
Serial
Hierarchy
 Object
      AbstractCollection
          AbstractQueue
              SynchronousQueue
Implements
 BlockingQueue
 Serializable
Subclasses
Description
public class SynchronousQueue
  A blocking queue in which each insert operation must wait for a corresponding remove operation by another thread, and vice versa.
See also:   
Constructors
public SynchronousQueue ()
Creates a SynchronousQueue with nonfair access policy.
public SynchronousQueue (boolean fair)
  Creates a SynchronousQueue with the specified fairness policy.
Methods
Hide/Show inherited methods
public boolean add ( E e) [Inherited From AbstractQueue]
  Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
public boolean addAll (Collection<Object> c) [Inherited From AbstractQueue]
  Adds all of the elements in the specified collection to this queue.
public void clear () [Overrides AbstractQueue]
  Does nothing.
public boolean contains (Object o) [Overrides AbstractCollection] [Specified in BlockingQueue]
  Always returns false.
public boolean containsAll (Collection<Object> c) [Overrides AbstractCollection]
  Returns false unless the given collection is empty.
public int drainTo (Collection<Object> c) [Specified in BlockingQueue]
 
public int drainTo (Collection<Object> c, int maxElements) [Specified in BlockingQueue]
 
public E element () [Inherited From AbstractQueue]
  Retrieves, but does not remove, the head of this queue.
public boolean isEmpty () [Overrides AbstractCollection]
  Always returns true.
public Iterator< E> iterator () [Specified in AbstractCollection]
  Returns an empty iterator in which hasNext always returns false.
public boolean offer ( E e) [Specified in BlockingQueue]
  Inserts the specified element into this queue, if another thread is waiting to receive it.
public boolean offer ( E o, long timeout, TimeUnit unit) throws InterruptedException [Specified in BlockingQueue]
  Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it.
public E peek ()
  Always returns null.
public E poll ()
  Retrieves and removes the head of this queue, if another thread is currently making an element available.
public E poll (long timeout, TimeUnit unit) throws InterruptedException [Specified in BlockingQueue]
  Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time, for another thread to insert it.
public void put ( E o) throws InterruptedException [Specified in BlockingQueue]
  Adds the specified element to this queue, waiting if necessary for another thread to receive it.
public int remainingCapacity () [Specified in BlockingQueue]
  Always returns zero.
public E remove () [Inherited From AbstractQueue]
  Retrieves and removes the head of this queue.
public boolean remove (Object o) [Overrides AbstractCollection] [Specified in BlockingQueue]
  Always returns false.
public boolean removeAll (Collection<Object> c) [Overrides AbstractCollection]
  Always returns false.
public boolean retainAll (Collection<Object> c) [Overrides AbstractCollection]
  Always returns false.
public int size () [Specified in AbstractCollection]
  Always returns zero.
public E take () throws InterruptedException [Specified in BlockingQueue]
  Retrieves and removes the head of this queue, waiting if necessary for another thread to insert it.
public Object toArray () [Overrides AbstractCollection]
  Returns a zero-length array.
public T toArray ( T a) [Overrides AbstractCollection]
  Sets the zeroeth element of the specified array to null (if the array has non-zero length) and returns it.
public String toString () [Inherited From AbstractCollection]
  Returns a string representation of this collection.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int maxTimedSpins
  The number of times to spin before blocking in timed waits.
pack-privatefinalstatic int maxUntimedSpins
  The number of times to spin before blocking in untimed waits.
pack-privatefinalstatic int NCPUS
The number of CPUs, for spin control
pack-privatefinalstatic long spinForTimeoutThreshold = "1000"
  The number of nanoseconds for which it is faster to spin rather than to use timed park.
Nested Classes
  SynchronousQueue.Transferer
Shared internal API for dual stacks and queues.
  SynchronousQueue.TransferStack
Dual stack
  SynchronousQueue.TransferQueue
Dual Queue
  SynchronousQueue.EmptyIterator
  SynchronousQueue.WaitQueue
  SynchronousQueue.LifoWaitQueue
  SynchronousQueue.FifoWaitQueue
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar