Class PersistentFileQueue

java.lang.Object
com.epam.fixengine.jms.storage.queue.PersistentFileQueue
All Implemented Interfaces:
IQueue

public class PersistentFileQueue extends Object implements IQueue
Implementation of persist queue (file only, without in-memory).
  • 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

      protected Map<byte[],Set<Integer>> maskedTags
    • isForcedFlush

      protected boolean isForcedFlush
  • Constructor Details

    • PersistentFileQueue

      public PersistentFileQueue(String filename)
  • Method Details

    • initialize

      public void initialize() throws IOException
      Description copied from interface: IQueue
      Initializes queue. That includes restore of previously saved queue content for persistent queues.
      Specified by:
      initialize in interface IQueue
      Throws:
      IOException
    • add

      public void add(byte[] itemBody) throws InterruptedException, IOException
      Description copied from interface: IQueue
      add message to queue.
      Specified by:
      add in interface IQueue
      Throws:
      InterruptedException
      IOException
    • add

      public void add(byte[] itemBody, String jmsMessageParams) throws InterruptedException, IOException
      Description copied from interface: IQueue
      add message to queue.
      Specified by:
      add in interface IQueue
      Throws:
      InterruptedException
      IOException
    • poll

      public IQueueable poll()
      Description copied from interface: IQueue
      Poll object from the queue (doesn't remove it from queue yet!). Change tem state to processing.
      Specified by:
      poll in interface IQueue
      Returns:
      the head of this queue, or null if this queue is empty
      See Also:
    • take

      public IQueueable take()
      Description copied from interface: IQueue
      Retrieves and mark as processing the head of this queue, waiting if necessary until an element becomes available.
      Specified by:
      take in interface IQueue
      Returns:
      the head of this queue
    • take

      public int take(IQueueable[] batch)
      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.
      Specified by:
      take in interface IQueue
      Returns:
      the number of read elements
    • commit

      public void commit(IQueueable item) throws IOException
      Description copied from interface: IQueue
      Removes polled object from the queue.
      Specified by:
      commit in interface IQueue
      Throws:
      IOException
    • commit

      public void commit(IQueueable[] batchItems, int size) throws IOException
      Description copied from interface: IQueue
      Removes polled objects from the queue.
      Specified by:
      commit in interface IQueue
      size - the number of items in batch
      Throws:
      IOException
    • failedProcessing

      public void failedProcessing(IQueueable item)
      Description copied from interface: IQueue
      Return element to queue. Item will be available again for handing.
      Specified by:
      failedProcessing in interface IQueue
    • failedProcessing

      public void failedProcessing(IQueueable[] batchItems, int size)
      Description copied from interface: IQueue
      Return element to queue. Items will be available again for handing.
      Specified by:
      failedProcessing in interface IQueue
      size - the number of items in batch
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: IQueue
      Checks if queue is currently empty.
      Specified by:
      isEmpty in interface IQueue
      Returns:
      true if empty
    • size

      public int size()
      Description copied from interface: IQueue
      Returns current queue size.
      Specified by:
      size in interface IQueue
      Returns:
      queue size
    • clear

      public void clear() throws IOException
      Description copied from interface: IQueue
      Clears the queue.
      Specified by:
      clear in interface IQueue
      Throws:
      IOException
    • shutdown

      public void shutdown()
      Description copied from interface: IQueue
      Gracefully shutdowns queue.
      Specified by:
      shutdown in interface IQueue
    • setNormalFileSize

      public void setNormalFileSize(long normalFileSize)
    • setMaskedTags

      public void setMaskedTags(Map<byte[],Set<Integer>> maskedTags)
    • setForcedFlush

      public void setForcedFlush(boolean isForcedFlush)
    • resetSeqNum

      protected void resetSeqNum()
    • setSeqNum

      protected void setSeqNum(int seqNum)