Skip to Content
Java in a Nutshell, 5th Edition
book

Java in a Nutshell, 5th Edition

by David Flanagan
March 2005
Intermediate to advanced
1254 pages
104h 21m
English
O'Reilly Media, Inc.
Content preview from Java in a Nutshell, 5th Edition

Name

LinkedBlockingQueue<E>

Synopsis

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.

java.util.concurrent.LinkedBlockingQueue<E>

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java in a Nutshell, 8th Edition

Java in a Nutshell, 8th Edition

Benjamin J. Evans, Jason Clark, David Flanagan
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 0596007736Supplemental ContentErrata Page