Package deltix.qsrv.hf.blocks
Class SimpleMarketMessageQueue
- java.lang.Object
-
- deltix.qsrv.hf.blocks.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.
-
-
Constructor Summary
Constructors Constructor Description SimpleMarketMessageQueue(int size)
SimpleMarketMessageQueue(int size, java.util.EnumSet<deltix.timebase.api.MarketMessageType> types)
SimpleMarketMessageQueue(int size, java.util.List<deltix.timebase.api.MarketMessageType> types)
-
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 returnsnull
if this queue is empty.deltix.timebase.api.messages.MarketMessage
peekLast()
Retrieves, but does not remove, the tail of this queue, or returnsnull
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 returnsnull
if this queue is empty.int
size()
-
-
-
Constructor Detail
-
SimpleMarketMessageQueue
public SimpleMarketMessageQueue(int size)
-
SimpleMarketMessageQueue
public SimpleMarketMessageQueue(int size, java.util.EnumSet<deltix.timebase.api.MarketMessageType> types)
- Parameters:
size
- queue sizetypes
- 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 sizetypes
- 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 interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
remove
public deltix.timebase.api.messages.MarketMessage remove()
Retrieves and removes the head of this queue, or returnsnull
if this queue is empty.- Specified by:
remove
in interfaceMarketMessageQueue<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 returnsnull
if this queue is empty.- Specified by:
peek
in interfaceMarketMessageQueue<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 returnsnull
if this queue is empty.- Specified by:
peekLast
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
isFull
public boolean isFull()
- Specified by:
isFull
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
size
public int size()
- Specified by:
size
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
release
public void release(deltix.timebase.api.messages.MarketMessage msg)
- Specified by:
release
in interfaceMarketMessageQueue<deltix.timebase.api.messages.MarketMessage>
-
-