Package com.epam.fixengine.storage.queue
Class PersistentInMemoryQueue<T extends Queueable>
java.lang.Object
com.epam.fixengine.storage.queue.InMemoryQueue<T>
com.epam.fixengine.storage.queue.PersistentInMemoryQueue<T>
- All Implemented Interfaces:
Queue<T>
public class PersistentInMemoryQueue<T extends Queueable>
extends InMemoryQueue<T>
implements Queue<T>
Persistent queue file format is the following:
1 byte record length length [n];
n bytes record length [m]
m bytes record itself
DELETE marker is byte == (byte)0;
- See Also:
-
Field Summary
FieldsFields inherited from class com.epam.fixengine.storage.queue.InMemoryQueue
application, maskedTags, session
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentInMemoryQueue
(String filename, QueueableFactory<T> factory) Deprecated.PersistentInMemoryQueue
(String filename, QueueableFactory<T> factory, com.epam.fixengine.configuration.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add object to the queue.protected boolean
appendEntryToFile
(Queueable entry) Appends entry to file.void
clear()
Clears the queue.void
commit()
Removes polled object from the queue.void
Initializes queue.void
shutdown()
Gracefully shutdowns queue.Methods inherited from class com.epam.fixengine.storage.queue.InMemoryQueue
addOutOfTurn, clearOutOfTurn, isAllEmpty, isApplicationCommit, isEmpty, isOutOfTurnOnlyMode, isShutdown, notifyAllApplication, notifyAllSession, poll, setOutOfTurnOnlyMode, size, toArray, totalSize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.epam.fixengine.storage.queue.Queue
addOutOfTurn, clearOutOfTurn, isAllEmpty, isEmpty, isOutOfTurnOnlyMode, notifyAllApplication, notifyAllSession, poll, setOutOfTurnOnlyMode, size, toArray, totalSize
-
Field Details
-
DELETE_MARKER
-
isForcedFlush
protected boolean isForcedFlush
-
-
Constructor Details
-
PersistentInMemoryQueue
Deprecated. -
PersistentInMemoryQueue
public PersistentInMemoryQueue(String filename, QueueableFactory<T> factory, com.epam.fixengine.configuration.Configuration conf)
-
-
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>
- Overrides:
initialize
in classInMemoryQueue<T extends Queueable>
- 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. -
add
Description copied from interface:Queue
Add object to the queue. -
appendEntryToFile
Appends entry to file.Methods append entry to file if it is opened. Method truncates the file only if entry is
DELETE_MARKER
and size of file grONE_MEG
.- Returns:
- false if entry doesn't append to file.
-
shutdown
public void shutdown()Description copied from interface:Queue
Gracefully shutdowns queue.
-