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 booleanstatic final longstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(byte[] itemBody) add message to queue.voidadd message to queue.voidclear()Clears the queue.voidcommit(IQueueable item) Removes polled object from the queue.voidcommit(IQueueable[] batchItems, int size) Removes polled objects from the queue.voidfailedProcessing(IQueueable item) Return element to queue.voidfailedProcessing(IQueueable[] batchItems, int size) Return element to queue.voidInitializes queue.booleanisEmpty()Checks if queue is currently empty.poll()Poll object from the queue (doesn't remove it from queue yet!).protected voidvoidsetForcedFlush(boolean isForcedFlush) voidsetMaskedTags(Map<byte[], Set<Integer>> maskedTags) voidsetNormalFileSize(long normalFileSize) protected voidsetSeqNum(int seqNum) voidshutdown()Gracefully shutdowns queue.intsize()Returns current queue size.take()Retrieves and mark as processing the head of this queue, waiting if necessary until an element becomes available.inttake(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:IQueueInitializes queue. That includes restore of previously saved queue content for persistent queues.- Specified by:
initializein interfaceIQueue- Throws:
IOException
-
add
Description copied from interface:IQueueadd message to queue.- Specified by:
addin interfaceIQueue- Throws:
InterruptedExceptionIOException
-
add
Description copied from interface:IQueueadd message to queue.- Specified by:
addin interfaceIQueue- Throws:
InterruptedExceptionIOException
-
poll
Description copied from interface:IQueuePoll object from the queue (doesn't remove it from queue yet!). Change tem state to processing. -
take
Description copied from interface:IQueueRetrieves and mark as processing the head of this queue, waiting if necessary until an element becomes available. -
take
Description copied from interface:IQueueRetrieves 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:IQueueRemoves polled object from the queue.- Specified by:
commitin interfaceIQueue- Throws:
IOException
-
commit
Description copied from interface:IQueueRemoves polled objects from the queue.- Specified by:
commitin interfaceIQueuesize- the number of items in batch- Throws:
IOException
-
failedProcessing
Description copied from interface:IQueueReturn element to queue. Item will be available again for handing.- Specified by:
failedProcessingin interfaceIQueue
-
failedProcessing
Description copied from interface:IQueueReturn element to queue. Items will be available again for handing.- Specified by:
failedProcessingin interfaceIQueuesize- the number of items in batch
-
isEmpty
public boolean isEmpty()Description copied from interface:IQueueChecks if queue is currently empty. -
size
public int size()Description copied from interface:IQueueReturns current queue size. -
clear
Description copied from interface:IQueueClears the queue.- Specified by:
clearin interfaceIQueue- Throws:
IOException
-
shutdown
public void shutdown()Description copied from interface:IQueueGracefully 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)
-