|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.zeigermann.xpa.tokenParser.BlockingLinkedListTokenQueue
This is class is a special form of a LinkedListTokenQueue
.
It is intended for a concurrent environment and manages queueing and
dequeueing if tokens following the well known producer/consumer strategy.
Communication of error states between consumer and producer is done
via the dequeue()
and setError(java.lang.Throwable)
methods.
Field Summary | |
protected Throwable |
error
|
protected LinkedListTokenQueue |
lltq
|
protected int |
maxBufferSize
|
Constructor Summary | |
BlockingLinkedListTokenQueue(int maxBufferSize)
Creates a new token queue. |
Method Summary | |
Token |
dequeue()
Removes a token from this queue and returns it. |
void |
queue(Token token)
Adds a token to this queue. |
void |
setError(Throwable error)
Sets an error state to communicate to consumer thread via the dequeue() method.
|
int |
size()
Gets the current size of the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected LinkedListTokenQueue lltq
protected int maxBufferSize
protected Throwable error
Constructor Detail |
public BlockingLinkedListTokenQueue(int maxBufferSize)
maxBufferSize
- maximum size of the queuequeue(antlr.Token)
Method Detail |
public void queue(Token token)
dequeue()
,
setError(java.lang.Throwable)
public Token dequeue() throws Throwable
setError(java.lang.Throwable)
this method will not block, but throw this error as an excpetion.
This allows for a communication of errors between the producer and
consumer.
Throwable
- communicates an error state set by producer
to consumerqueue(antlr.Token)
,
setError(java.lang.Throwable)
public int size()
public void setError(Throwable error)
dequeue()
method.
Normally this method is called by the thread that is also calling
the queue(antlr.Token)
method, i.e. the thread playing the role of the
producer.
queue(antlr.Token)
,
dequeue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |