Class PersistentFileQueue
java.lang.Object
com.epam.fixengine.jms.storage.queue.PersistentFileQueue
- All Implemented Interfaces:
IQueue
Implementation of persist queue (file only, without in-memory).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
static final long
static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(byte[] itemBody) add message to queue.void
add message to queue.void
clear()
Clears the queue.void
commit
(IQueueable item) Removes polled object from the queue.void
commit
(IQueueable[] batchItems, int size) Removes polled objects from the queue.void
failedProcessing
(IQueueable item) Return element to queue.void
failedProcessing
(IQueueable[] batchItems, int size) Return element to queue.void
Initializes queue.boolean
isEmpty()
Checks if queue is currently empty.poll()
Poll object from the queue (doesn't remove it from queue yet!).protected void
void
setForcedFlush
(boolean isForcedFlush) void
setMaskedTags
(Map<byte[], Set<Integer>> maskedTags) void
setNormalFileSize
(long normalFileSize) protected void
setSeqNum
(int seqNum) void
shutdown()
Gracefully shutdowns queue.int
size()
Returns current queue size.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.
-
Field Details
-
NORMAL_FILE_SIZE
public static final long NORMAL_FILE_SIZE- See Also:
-
MAX_FILE_SIZE
public static final long MAX_FILE_SIZE- See Also:
-
maskedTags
-
isForcedFlush
protected boolean isForcedFlush
-
-
Constructor Details
-
PersistentFileQueue
-
-
Method Details
-
initialize
Description copied from interface:IQueue
Initializes queue. That includes restore of previously saved queue content for persistent queues.- Specified by:
initialize
in interfaceIQueue
- Throws:
IOException
-
add
Description copied from interface:IQueue
add message to queue.- Specified by:
add
in interfaceIQueue
- Throws:
InterruptedException
IOException
-
add
Description copied from interface:IQueue
add message to queue.- Specified by:
add
in interfaceIQueue
- Throws:
InterruptedException
IOException
-
poll
Description copied from interface:IQueue
Poll object from the queue (doesn't remove it from queue yet!). Change tem state to processing. -
take
Description copied from interface:IQueue
Retrieves and mark as processing the head of this queue, waiting if necessary until an element becomes available. -
take
Description copied from interface:IQueue
Retrieves and mark as processing the batch elements from head of this queue, waiting if necessary until at least one element becomes available. -
commit
Description copied from interface:IQueue
Removes polled object from the queue.- Specified by:
commit
in interfaceIQueue
- Throws:
IOException
-
commit
Description copied from interface:IQueue
Removes polled objects from the queue.- Specified by:
commit
in interfaceIQueue
size
- the number of items in batch- Throws:
IOException
-
failedProcessing
Description copied from interface:IQueue
Return element to queue. Item will be available again for handing.- Specified by:
failedProcessing
in interfaceIQueue
-
failedProcessing
Description copied from interface:IQueue
Return element to queue. Items will be available again for handing.- Specified by:
failedProcessing
in interfaceIQueue
size
- the number of items in batch
-
isEmpty
public boolean isEmpty()Description copied from interface:IQueue
Checks if queue is currently empty. -
size
public int size()Description copied from interface:IQueue
Returns current queue size. -
clear
Description copied from interface:IQueue
Clears the queue.- Specified by:
clear
in interfaceIQueue
- Throws:
IOException
-
shutdown
public void shutdown()Description copied from interface:IQueue
Gracefully shutdowns queue. -
setNormalFileSize
public void setNormalFileSize(long normalFileSize) -
setMaskedTags
-
setForcedFlush
public void setForcedFlush(boolean isForcedFlush) -
resetSeqNum
protected void resetSeqNum() -
setSeqNum
protected void setSeqNum(int seqNum)
-