Class InMemoryQueue<T>
Memory queue implementation.
Inherited Members
Namespace: FixAntenna.FixEngine.Storage.Queue
Assembly: FixAntenna.Core.dll
Syntax
public class InMemoryQueue<T> : IQueue<T>, IDisposable where T : IQueueable
Type Parameters
Name | Description |
---|---|
T |
Constructors
InMemoryQueue()
Create the memory queue.
Declaration
public InMemoryQueue()
Fields
Application
Declaration
protected readonly LinkedList<T> Application
Field Value
Type | Description |
---|---|
System.Collections.Generic.LinkedList<T> |
Session
Declaration
protected readonly LinkedList<T> Session
Field Value
Type | Description |
---|---|
System.Collections.Generic.LinkedList<T> |
Methods
Add(T)
Add object to the queue.
Declaration
public virtual bool Add(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object |
Returns
Type | Description |
---|---|
System.Boolean | true if element added successfully. |
AddOutOfTurn(T)
Add object to the queue out of turn.
Declaration
public virtual bool AddOutOfTurn(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object |
Returns
Type | Description |
---|---|
System.Boolean | true if element added successfully. |
Clear()
Clears the queue.
Declaration
public virtual void Clear()
ClearOutOfTurn(Action<T>)
Removes the elements which were added by AddOutOfTurn(T).
Declaration
public virtual void ClearOutOfTurn(Action<T> elementConsumer)
Parameters
Type | Name | Description |
---|---|---|
System.Action<T> | elementConsumer | callback for each removed message. It is called after removing next message. |
Commit()
Removes polled object from the queue. If nothing was polled - throws IllegalStateException
Declaration
public virtual void Commit()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Initialize()
Initializes queue. That includes restore of previously saved queue content for persistent queues.
Declaration
public virtual void Initialize()
IsAllEmpty()
Declaration
public virtual bool IsAllEmpty()
Returns
Type | Description |
---|---|
System.Boolean |
IsApplicationCommit()
Return true if last commit was application.
Declaration
public virtual bool IsApplicationCommit()
Returns
Type | Description |
---|---|
System.Boolean |
IsEmpty()
Checks if queue is currently empty.
Declaration
public virtual bool IsEmpty()
Returns
Type | Description |
---|---|
System.Boolean | true if empty |
IsOutOfTurnOnlyMode()
Out of turn messages only mode.
Declaration
public virtual bool IsOutOfTurnOnlyMode()
Returns
Type | Description |
---|---|
System.Boolean |
IsShutdown()
Returns true if queue is shutdown.
Declaration
public virtual bool IsShutdown()
Returns
Type | Description |
---|---|
System.Boolean |
NotifyAllApplication()
Notify a new application message exists.
The methods works only if turn "mode on" is off.
Declaration
public virtual void NotifyAllApplication()
See Also
NotifyAllSession()
Notify a new session message exists.
Declaration
public virtual void NotifyAllSession()
Poll()
Poll object from the queue (doesn't remove it from queue yet!).
Declaration
public virtual T Poll()
Returns
Type | Description |
---|---|
T | the head of this queue, or null if this queue is empty |
See Also
SetOutOfTurnOnlyMode(Boolean)
Out of turn messages only mode.
Declaration
public virtual void SetOutOfTurnOnlyMode(bool newMode)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | newMode |
Shutdown()
Gracefully shutdowns queue.
Declaration
public virtual void Shutdown()
Size()
Returns current queue size.
Declaration
public virtual int Size()
Returns
Type | Description |
---|---|
System.Int32 | queue size |
ToArray()
Return all objects in the queue as array. Method has no impact on poll / commit operations.
Declaration
public virtual IQueueable[] ToArray()
Returns
Type | Description |
---|---|
IQueueable[] | array of IQueueable |
TotalSize()
Returns current total queue size. The total size of the usual queue and the OutOfTurn queue.
Declaration
public virtual int TotalSize()
Returns
Type | Description |
---|---|
System.Int32 | queue size |