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 TypeMethodDescriptionbooleanAdd object to the queue.booleanaddOutOfTurn(T object) Add object to the queue out of turn.voidclear()Clears the queue.voidclearOutOfTurn(Consumer<T> elementConsumer) Removes the elements which were added byaddOutOfTurn.voidcommit()Removes polled object from the queue.voidInitializes queue.booleanbooleanReturn true if last commit was application.booleanisEmpty()Checks if queue is currently empty.booleanOut of turn messages only mode.protected booleanReturns true if queue is shutdown.voidNotify a new application message exists.voidNotify a new session message exists.poll()Poll object from the queue (doesn't remove it from queue yet!).voidsetOutOfTurnOnlyMode(boolean newMode) Out of turn messages only mode.voidshutdown()Gracefully shutdowns queue.intsize()Returns current queue size.toArray()Return all objects in the queue as array.intReturns 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:QueueInitializes queue. That includes restore of previously saved queue content for persistent queues.- Specified by:
initializein interfaceQueue<T extends Queueable>- See Also:
-
size
public int size()Description copied from interface:QueueReturns current queue size. -
totalSize
public int totalSize()Description copied from interface:QueueReturns current total queue size. The total size of the usual queue and the OutOfTurn queue. -
isEmpty
public boolean isEmpty()Description copied from interface:QueueChecks if queue is currently empty. -
isAllEmpty
public boolean isAllEmpty()- Specified by:
isAllEmptyin interfaceQueue<T extends Queueable>
-
add
Description copied from interface:QueueAdd object to the queue. -
addOutOfTurn
Description copied from interface:QueueAdd object to the queue out of turn.- Specified by:
addOutOfTurnin interfaceQueue<T extends Queueable>- Parameters:
object- the element- Returns:
- true if element added successfully.
- See Also:
-
poll
Description copied from interface:QueuePoll object from the queue (doesn't remove it from queue yet!). -
setOutOfTurnOnlyMode
public void setOutOfTurnOnlyMode(boolean newMode) Description copied from interface:QueueOut of turn messages only mode.- Specified by:
setOutOfTurnOnlyModein interfaceQueue<T extends Queueable>- Parameters:
newMode- the mode- See Also:
-
isOutOfTurnOnlyMode
public boolean isOutOfTurnOnlyMode()Description copied from interface:QueueOut of turn messages only mode.- Specified by:
isOutOfTurnOnlyModein interfaceQueue<T extends Queueable>
-
clearOutOfTurn
Description copied from interface:QueueRemoves the elements which were added byaddOutOfTurn.- Specified by:
clearOutOfTurnin 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:QueueRemoves polled object from the queue. If nothing was polled - throws IllegalStateException -
clear
public void clear()Description copied from interface:QueueClears the queue. -
shutdown
public void shutdown()Description copied from interface:QueueGracefully 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:QueueNotify a new application message exists.The methods works only if turn "mode on" is off.
- Specified by:
notifyAllApplicationin interfaceQueue<T extends Queueable>- See Also:
-
notifyAllSession
public void notifyAllSession()Description copied from interface:QueueNotify a new session message exists.- Specified by:
notifyAllSessionin interfaceQueue<T extends Queueable>
-
toArray
Description copied from interface:QueueReturn all objects in the queue as array. Method has no impact on poll / commit operations.
-