jamod at SF

net.wimpi.modbus.util
Class LinkedQueue

java.lang.Object
  extended bynet.wimpi.modbus.util.LinkedQueue

public class LinkedQueue
extends java.lang.Object


Field Summary
protected  LinkedNode m_Head
          Dummy header node of list.
protected  java.lang.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 Summary
LinkedQueue()
           
 
Method Summary
protected  java.lang.Object extract()
          Main mechanics for take/poll
protected  void insert(java.lang.Object x)
          Main mechanics for put/offer
 boolean isEmpty()
           
 boolean offer(java.lang.Object x, long msecs)
           
 java.lang.Object peek()
           
 java.lang.Object poll(long msecs)
           
 void put(java.lang.Object x)
           
 java.lang.Object take()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Head

protected LinkedNode m_Head
Dummy header node of list. The first actual node, if it exists, is always at m_Head.m_NextNode. After each take, the old first node becomes the head.


m_PutLock

protected final java.lang.Object m_PutLock
Helper monitor for managing access to last node.


m_Tail

protected LinkedNode m_Tail
The last node of list. Put() appends to list, so modifies m_Tail_


m_WaitingForTake

protected int m_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.

Constructor Detail

LinkedQueue

public LinkedQueue()
Method Detail

insert

protected void insert(java.lang.Object x)
Main mechanics for put/offer


extract

protected java.lang.Object extract()
Main mechanics for take/poll


put

public void put(java.lang.Object x)
         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

offer

public boolean offer(java.lang.Object x,
                     long msecs)
              throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

take

public java.lang.Object take()
                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

peek

public java.lang.Object peek()

isEmpty

public boolean isEmpty()

poll

public java.lang.Object poll(long msecs)
                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

jamod at SF

Copyright © 2002-2004 jamod development team.