Class LimitedPriorityQueue
- Namespace
- Sportradar.LiveData.Sdk.Services.PriorityQueue
- Assembly
- Sportradar.LiveData.Sdk.dll
Extends basic PriorityQueue implementation by checking the queue capacity limits and lo-hi queue watermarks. Whenever one of those thresholds are breached an OnLimits event is triggered. Lo watermark can be used to detect that a queue is slowly getting filled up and there is still time to react to this. High watermark usually triggers some self-defense mechanism like stopping all incoming message delivery and processing. This is a thread-safe implementation.
public class LimitedPriorityQueue : PriorityQueue, ILimitedPriorityQueue, IPriorityQueue
- Inheritance
-
LimitedPriorityQueue
- Implements
- Inherited Members
Constructors
LimitedPriorityQueue(ISdkLogger, ISdkConfiguration)
public LimitedPriorityQueue(ISdkLogger sdk_logger, ISdkConfiguration config)
Parameters
sdk_loggerISdkLoggerconfigISdkConfiguration
Fields
m_config
protected ISdkConfiguration m_config
Field Value
m_high_limit_reached
protected bool m_high_limit_reached
Field Value
m_low_limit_reached
protected bool m_low_limit_reached
Field Value
Methods
Clear()
Empties the queue.
public override void Clear()
Dequeue()
Dequeues an object from the priority queue. Returns null if the queue is empty
public override PriorityQueueElt Dequeue()
Returns
- PriorityQueueElt
The top item (max priority) from the queue or null if it does not exist.
Dequeue(Priority)
Dequeues an object of specific priority from the priority queue. Returns null if the queue is empty.
public override PriorityQueueElt Dequeue(Priority prio)
Parameters
prioPriorityPriority constraint
Returns
- PriorityQueueElt
The top item (max priority) from the queue or null if it does not exist.
Dequeue(Priority, TimeSpan)
Dequeues an object of specific priority from the priority queue.
public override PriorityQueueElt Dequeue(Priority prio, TimeSpan timeout)
Parameters
Returns
- PriorityQueueElt
The top item (max priority) from the queue. Returns null in case of timeout.
Dequeue(TimeSpan)
Dequeues an object from the priority queue.
public override PriorityQueueElt Dequeue(TimeSpan timeout)
Parameters
timeoutTimeSpanThe number of milliseconds to wait
Returns
- PriorityQueueElt
The top item (max priority) from the queue. Returns null in case of timeout.
Enqueue(PriorityQueueElt)
Enqueues an item to the priority queue.
public override void Enqueue(PriorityQueueElt elt)
Parameters
eltPriorityQueueElt
Events
OnLimits
Signals that a queue limit (HIGH, LOW, NORMAL) has been reached or retreated for a specific queue.
public event LimitedPriorityQueueDelegates.QueueLimitDelegate OnLimits