|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.uima.collection.impl.cpm.engine.BoundedWorkQueue
public class BoundedWorkQueue
Implementation of a Bounded Queue, a queue with a fixed number of slots. Used primarily to feed data to Processing Units, it is filled by a producer like ArtifactProducer and consumed by ProcessingUnit(s). When the queue is full it will block a request for enqueue until a slot frees up.
There are 2 dequeue calls. One returns null if the queue is empty, the other can be given a timeout - and it will wait up to that time waiting for something to get enqueued.
Field Summary | |
---|---|
protected CPMEngine |
cpm
|
protected int |
numberElementsInQueue
|
protected java.util.LinkedList |
queue
|
protected int |
queueMaxSize
|
protected java.lang.String |
queueName
|
protected static int |
WAIT_TIMEOUT
|
Constructor Summary | |
---|---|
BoundedWorkQueue(int aQueueSize,
java.lang.String aQueueName,
CPMEngine aCpmEngine)
Initialize the instance |
Method Summary | |
---|---|
java.lang.Object |
dequeue()
Removes an object from the front of the queue according to FIFO. |
java.lang.Object |
dequeue(long aTimeout)
Returns an object from the queue. |
void |
enqueue(java.lang.Object anObject)
Enqueues a given object onto the queue. |
int |
getCapacity()
Returns the queue capacity |
int |
getCurrentSize()
Returns number of elements in the queue. |
java.lang.String |
getName()
Returns Queue name |
void |
invalidate(CAS[] aCasObjectList)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int queueMaxSize
protected java.util.LinkedList queue
protected int numberElementsInQueue
protected java.lang.String queueName
protected CPMEngine cpm
protected static final int WAIT_TIMEOUT
Constructor Detail |
---|
public BoundedWorkQueue(int aQueueSize, java.lang.String aQueueName, CPMEngine aCpmEngine)
aQueueSize
- -
fixed size for this queue (capacity)aQueueName
- -
name for this queueaCpmEngine
- -
CPE Engine referenceMethod Detail |
---|
public java.lang.String getName()
public int getCurrentSize()
public int getCapacity()
public void enqueue(java.lang.Object anObject)
anObject
- -
an object to enqueuepublic java.lang.Object dequeue()
public java.lang.Object dequeue(long aTimeout)
aTimeout
- -
max millis to wait for an object
public void invalidate(CAS[] aCasObjectList)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |