Package com.epam.fixengine.storage.queue
Class InMemoryQueue<T extends Queueable>
java.lang.Object
com.epam.fixengine.storage.queue.InMemoryQueue<T>
- All Implemented Interfaces:
Queue<T>
- Direct Known Subclasses:
MMFPersistentInMemoryQueue
,PersistentInMemoryQueue
Memory queue implementation.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.InMemoryQueue
(com.epam.fixengine.configuration.Configuration conf) Create the memory queue. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add object to the queue.boolean
addOutOfTurn
(T object) Add object to the queue out of turn.void
clear()
Clears the queue.void
clearOutOfTurn
(Consumer<T> elementConsumer) Removes the elements which were added byaddOutOfTurn
.void
commit()
Removes polled object from the queue.void
Initializes queue.boolean
boolean
Return true if last commit was application.boolean
isEmpty()
Checks if queue is currently empty.boolean
Out of turn messages only mode.protected boolean
Returns true if queue is shutdown.void
Notify a new application message exists.void
Notify a new session message exists.poll()
Poll object from the queue (doesn't remove it from queue yet!).void
setOutOfTurnOnlyMode
(boolean newMode) Out of turn messages only mode.void
shutdown()
Gracefully shutdowns queue.int
size()
Returns current queue size.toArray()
Return all objects in the queue as array.int
Returns current total queue size.
-
Field Details
-
application
-
session
-
maskedTags
-
-
Constructor Details
-
InMemoryQueue
Deprecated. -
InMemoryQueue
public InMemoryQueue(com.epam.fixengine.configuration.Configuration conf) Create the memory queue.
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:Queue
Initializes queue. That includes restore of previously saved queue content for persistent queues.- Specified by:
initialize
in interfaceQueue<T extends Queueable>
- See Also:
-
size
public int size()Description copied from interface:Queue
Returns current queue size. -
totalSize
public int totalSize()Description copied from interface:Queue
Returns current total queue size. The total size of the usual queue and the OutOfTurn queue. -
isEmpty
public boolean isEmpty()Description copied from interface:Queue
Checks if queue is currently empty. -
isAllEmpty
public boolean isAllEmpty()- Specified by:
isAllEmpty
in interfaceQueue<T extends Queueable>
-
add
Description copied from interface:Queue
Add object to the queue. -
addOutOfTurn
Description copied from interface:Queue
Add object to the queue out of turn.- Specified by:
addOutOfTurn
in interfaceQueue<T extends Queueable>
- Parameters:
object
- the element- Returns:
- true if element added successfully.
- See Also:
-
poll
Description copied from interface:Queue
Poll object from the queue (doesn't remove it from queue yet!). -
setOutOfTurnOnlyMode
public void setOutOfTurnOnlyMode(boolean newMode) Description copied from interface:Queue
Out of turn messages only mode.- Specified by:
setOutOfTurnOnlyMode
in interfaceQueue<T extends Queueable>
- Parameters:
newMode
- the mode- See Also:
-
isOutOfTurnOnlyMode
public boolean isOutOfTurnOnlyMode()Description copied from interface:Queue
Out of turn messages only mode.- Specified by:
isOutOfTurnOnlyMode
in interfaceQueue<T extends Queueable>
-
clearOutOfTurn
Description copied from interface:Queue
Removes the elements which were added byaddOutOfTurn
.- Specified by:
clearOutOfTurn
in interfaceQueue<T extends Queueable>
- Parameters:
elementConsumer
- callback for each removed message. It is called after removing next message.- See Also:
-
commit
public void commit()Description copied from interface:Queue
Removes polled object from the queue. If nothing was polled - throws IllegalStateException -
clear
public void clear()Description copied from interface:Queue
Clears the queue. -
shutdown
public void shutdown()Description copied from interface:Queue
Gracefully shutdowns queue. -
isShutdown
protected boolean isShutdown()Returns true if queue is shutdown. -
isApplicationCommit
public boolean isApplicationCommit()Return true if last commit was application. -
notifyAllApplication
public void notifyAllApplication()Description copied from interface:Queue
Notify a new application message exists.The methods works only if turn "mode on" is off.
- Specified by:
notifyAllApplication
in interfaceQueue<T extends Queueable>
- See Also:
-
notifyAllSession
public void notifyAllSession()Description copied from interface:Queue
Notify a new session message exists.- Specified by:
notifyAllSession
in interfaceQueue<T extends Queueable>
-
toArray
Description copied from interface:Queue
Return all objects in the queue as array. Method has no impact on poll / commit operations.
-