| java.lang.Object EDU.oswego.cs.dl.util.concurrent.LinkedQueue
LinkedQueue | public class LinkedQueue implements Channel(Code) | | 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. ]
|
head_ | protected LinkedNode head_(Code) | | 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.
|
last_ | protected LinkedNode last_(Code) | | The last node of list. Put() appends to list, so modifies last_
|
putLock_ | final protected Object putLock_(Code) | | Helper monitor for managing access to last node.
|
waitingForTake_ | protected int waitingForTake_(Code) | | 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.
|
LinkedQueue | public LinkedQueue()(Code) | | |
extract | protected synchronized Object extract()(Code) | | Main mechanics for take/poll *
|
insert | protected void insert(Object x)(Code) | | Main mechanics for put/offer *
|
isEmpty | public boolean isEmpty()(Code) | | |
|
|