This
threadsafe
class implements the BlockingQueue interface based
on a linked-list data structure. It orders elements on a first-in,
first-out (FIFO) basis. You may specify a maximum queue capacity,
creating a bounded queue. The default capacity is
Integer.MAX_VALUE, which is effectively unbounded.
null elements are not permitted.
Figure 16-86. java.util.concurrent.LinkedBlockingQueue<E>
public class
LinkedBlockingQueue<E> extends java.util.AbstractQueue<E>
implements BlockingQueue<E>, Serializable {
// Public Constructors
public
LinkedBlockingQueue ( );
public
LinkedBlockingQueue (int
capacity );
public
LinkedBlockingQueue (java.util.Collection<? extends E>
c );
// Methods Implementing BlockingQueue
public int
drainTo (java.util.Collection<? super E>
c );
public int
drainTo (java.util.Collection<? super E>
c , int
maxElements );
public boolean
offer (E
o );
public boolean
offer (E
o , long
timeout , TimeUnit
unit ) throws InterruptedException;
public E
poll (long
timeout , TimeUnit
unit ) throws InterruptedException;
public void
put (E
o ) throws InterruptedException;
public int
remainingCapacity ( );
public E
take ( ) throws InterruptedException;
// Methods Implementing Collection
public void
clear ( );
public java.util.Iterator<E>
iterator ( );
public boolean
remove (Object
o );
public int
size ( );
public Object[ ]
toArray ( );
public <T> T[ ]
toArray (T[ ]
a );
// Methods Implementing Queue
public E
peek ( );
public E
poll ( );
// Public Methods Overriding AbstractCollection
public String
toString ( );
}