public class BoundedWorkQueue extends 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 LinkedList |
queue |
protected int |
queueMaxSize |
protected String |
queueName |
protected static int |
WAIT_TIMEOUT |
Constructor and Description |
---|
BoundedWorkQueue(int aQueueSize,
String aQueueName,
CPMEngine aCpmEngine)
Initialize the instance
|
Modifier and Type | Method and Description |
---|---|
Object |
dequeue()
Removes an object from the front of the queue according to FIFO.
|
Object |
dequeue(long aTimeout)
Returns an object from the queue.
|
void |
enqueue(Object anObject)
Enqueues a given object onto the queue.
|
int |
getCapacity()
Returns the queue capacity
|
int |
getCurrentSize()
Returns number of elements in the queue.
|
String |
getName()
Returns Queue name
|
void |
invalidate(CAS[] aCasObjectList) |
protected final int queueMaxSize
protected LinkedList queue
protected int numberElementsInQueue
protected String queueName
protected CPMEngine cpm
protected static final int WAIT_TIMEOUT
public String getName()
public int getCurrentSize()
public int getCapacity()
public void enqueue(Object anObject)
anObject
- -
an object to enqueuepublic Object dequeue()
public Object dequeue(long aTimeout)
aTimeout
- -
max millis to wait for an objectpublic void invalidate(CAS[] aCasObjectList)
Copyright © 2019. All rights reserved.