Class SimpleMarketMessageQueue

  • All Implemented Interfaces:
    MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>

    public final class SimpleMarketMessageQueue
    extends java.lang.Object
    implements MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
    Non-blocking fixed-size circular queue of MarketMessages that stores a copy of MarketMessages. Not thread safe.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(deltix.timebase.api.messages.MarketMessage msg)
      Adds element to the tail of the queue.
      void dispose()  
      boolean isEmpty()  
      boolean isFull()  
      deltix.timebase.api.messages.MarketMessage peek()
      Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
      deltix.timebase.api.messages.MarketMessage peekLast()
      Retrieves, but does not remove, the tail of this queue, or returns null if this queue is empty.
      void release​(deltix.timebase.api.messages.MarketMessage msg)  
      deltix.timebase.api.messages.MarketMessage remove()
      Retrieves and removes the head of this queue, or returns null if this queue is empty.
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleMarketMessageQueue

        public SimpleMarketMessageQueue​(int size)
      • SimpleMarketMessageQueue

        public SimpleMarketMessageQueue​(int size,
                                        java.util.EnumSet<deltix.timebase.api.MarketMessageType> types)
        Parameters:
        size - queue size
        types - if not null, only messages of given type are allowed in the queue
      • SimpleMarketMessageQueue

        public SimpleMarketMessageQueue​(int size,
                                        java.util.List<deltix.timebase.api.MarketMessageType> types)
        Parameters:
        size - queue size
        types - if not null, only messages of given type are allowed in the queue
    • Method Detail

      • add

        public void add​(deltix.timebase.api.messages.MarketMessage msg)
        Adds element to the tail of the queue. If capacity is exceeded new element overrides the oldest one (head)
        Specified by:
        add in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • remove

        public deltix.timebase.api.messages.MarketMessage remove()
        Retrieves and removes the head of this queue, or returns null if this queue is empty.
        Specified by:
        remove in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
        Returns:
        the head of this queue, or null if this queue is empty
      • peek

        public deltix.timebase.api.messages.MarketMessage peek()
        Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
        Specified by:
        peek in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • peekLast

        public deltix.timebase.api.messages.MarketMessage peekLast()
        Description copied from interface: MarketMessageQueue
        Retrieves, but does not remove, the tail of this queue, or returns null if this queue is empty.
        Specified by:
        peekLast in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • isFull

        public boolean isFull()
        Specified by:
        isFull in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • size

        public int size()
        Specified by:
        size in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • dispose

        public void dispose()
        Specified by:
        dispose in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
      • release

        public void release​(deltix.timebase.api.messages.MarketMessage msg)
        Specified by:
        release in interface MarketMessageQueue<deltix.timebase.api.messages.MarketMessage>