Home » concurrent-sources » EDU.oswego.cs.dl.util.concurrent » [javadoc | source]
public class: LinkedQueue [javadoc | source]

All Implemented Interfaces:

A linked list based channel implementation. The algorithm avoids contention between puts and takes when the queue is not empty. Normally a put and a take can proceed simultaneously. (Although it does not allow multiple concurrent puts or takes.) This class tends to perform more efficently than other Channel implementations in producer/consumer applications.

[ Introduction to this package. ]
Field Summary
protected  LinkedNode head_    Dummy header node of list. The first actual node, if it exists, is always at head_.next. After each take, the old first node becomes the head. 
protected final  Object putLock_    Helper monitor for managing access to last node. 
protected  LinkedNode last_    The last node of list. Put() appends to list, so modifies last_ 
protected  int waitingForTake_    The number of threads waiting for a take. Notifications are provided in put only if greater than zero. The bookkeeping is worth it here since in reasonably balanced usages, the notifications will hardly ever be necessary, so the call overhead to notify can be eliminated. 
 public LinkedQueue() 
Method from EDU.oswego.cs.dl.util.concurrent.LinkedQueue Summary:
extract,   insert,   isEmpty,   offer,   peek,   poll,   put,   take
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from EDU.oswego.cs.dl.util.concurrent.LinkedQueue Detail:
 protected synchronized Object extract() 
    Main mechanics for take/poll *
 protected  void insert(Object x) 
    Main mechanics for put/offer *
 public boolean isEmpty() 
 public boolean offer(Object x,
    long msecs) throws InterruptedException 
 public Object peek() 
 public Object poll(long msecs) throws InterruptedException 
 public  void put(Object x) throws InterruptedException 
 public Object take() throws InterruptedException