public class BoundedWorkQueue
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
BoundedWorkQueue(int aQueueSize,
java.lang.String aQueueName,
CPMEngine aCpmEngine)
Initialize the instance
|
Modifier and Type | Method and Description |
---|---|
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) |
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
public BoundedWorkQueue(int aQueueSize, java.lang.String aQueueName, CPMEngine aCpmEngine)
aQueueSize
- -
fixed size for this queue (capacity)aQueueName
- -
name for this queueaCpmEngine
- -
CPE Engine referencepublic 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 objectpublic void invalidate(CAS[] aCasObjectList)
Copyright © 2013. All Rights Reserved.