public class InMemoryQueue extends Object implements IQueue
Constructor and Description |
---|
InMemoryQueue(int capacity,
long publishTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
add(FIXFieldList fixMessage)
add message to queue.
|
protected void |
addRestored(int seqNum,
byte[] data) |
void |
clear()
Atomically removes all of the elements from this queue.
|
void |
commit(IQueueable object)
Removes polled object from the queue.
|
void |
commit(IQueueable[] batchItems,
int size)
Removes polled objects from the queue.
|
void |
failedProcessing(IQueueable object)
Return element to queue.
|
void |
failedProcessing(IQueueable[] batchItems,
int size)
Return element to queue.
|
void |
initialize()
Initializes queue.
|
boolean |
isEmpty()
Checks if queue is currently empty.
|
protected boolean |
isEmptyInner()
Check is empty without lock
|
protected void |
onCommit(IQueueable x) |
protected void |
onInsert(IQueueable x) |
IQueueable |
poll()
Poll object from the queue (doesn't remove it from queue yet!).
|
protected void |
resetSeqNum() |
protected void |
setSeqNum(int seqNum) |
void |
shutdown()
Gracefully shutdowns queue.
|
int |
size()
Returns the number of elements in this queue.
|
IQueueable |
take()
Retrieves and mark as processing the head of this queue, waiting if necessary
until an element becomes available.
|
int |
take(IQueueable[] batch)
Retrieves and mark as processing the batch elements from head of this queue, waiting if necessary
until at least one element becomes available.
|
public void initialize() throws IOException
IQueue
initialize
in interface IQueue
IOException
IQueue.initialize()
public int size()
public boolean isEmpty()
IQueue
isEmpty
in interface IQueue
IQueue.isEmpty()
protected boolean isEmptyInner()
public void add(FIXFieldList fixMessage) throws InterruptedException, IOException
IQueue
add
in interface IQueue
InterruptedException
IOException
public IQueueable poll()
IQueue
poll
in interface IQueue
IQueue.poll()
public IQueueable take()
take
in interface IQueue
IllegalStateException
- if interrupted while waitingpublic int take(IQueueable[] batch)
IQueue
public void failedProcessing(IQueueable object)
IQueue
failedProcessing
in interface IQueue
public void failedProcessing(IQueueable[] batchItems, int size)
IQueue
failedProcessing
in interface IQueue
size
- the number of items in batchpublic void commit(IQueueable object) throws IOException
IQueue
commit
in interface IQueue
IOException
IQueue.commit(IQueueable object)
public void commit(IQueueable[] batchItems, int size) throws IOException
IQueue
commit
in interface IQueue
size
- the number of items in batchIOException
public void clear() throws IOException
clear
in interface IQueue
IOException
public void shutdown()
IQueue
shutdown
in interface IQueue
IQueue.shutdown()
protected void resetSeqNum()
protected void setSeqNum(int seqNum)
protected void addRestored(int seqNum, byte[] data)
protected void onInsert(IQueueable x) throws IOException
IOException
protected void onCommit(IQueueable x) throws IOException
IOException
Copyright © 2000–2022 EPAM Systems. All rights reserved.