public class LinkedQueue extends Object
| Modifier and Type | Field and Description |
|---|---|
protected LinkedNode |
m_Head
Dummy header node of list.
|
protected Object |
m_PutLock
Helper monitor for managing access to last node.
|
protected LinkedNode |
m_Tail
The last node of list.
|
protected int |
m_WaitingForTake
The number of threads waiting for a take.
|
| Constructor and Description |
|---|
LinkedQueue()
Instantiates a new Linked queue.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
extract()
Main mechanics for take/poll
|
protected void |
insert(Object x)
Main mechanics for put/offer
|
boolean |
isEmpty()
Is empty boolean.
|
boolean |
offer(Object x,
long msecs)
Offer boolean.
|
Object |
peek()
Peek object.
|
Object |
poll(long msecs)
Poll object.
|
void |
put(Object x)
Put.
|
Object |
take()
Take object.
|
protected LinkedNode m_Head
protected final Object m_PutLock
protected LinkedNode m_Tail
protected int m_WaitingForTake
protected void insert(Object x)
x - the xprotected Object extract()
public void put(Object x) throws InterruptedException
x - the xInterruptedException - the interrupted exceptionpublic boolean offer(Object x, long msecs) throws InterruptedException
x - the xmsecs - the msecsInterruptedException - the interrupted exceptionpublic Object take() throws InterruptedException
InterruptedException - the interrupted exceptionpublic Object peek()
public boolean isEmpty()
public Object poll(long msecs) throws InterruptedException
msecs - the msecsInterruptedException - the interrupted exceptionCopyright © 2017. All rights reserved.