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 TypeMethodDescriptionbooleanAdd object to the queue.protected booleanappendEntryToFile(Queueable entry) Appends entry to file.voidclear()Clears the queue.voidcommit()Removes polled object from the queue.voidInitializes queue.voidshutdown()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, totalSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:QueueInitializes queue. That includes restore of previously saved queue content for persistent queues.- Specified by:
initializein interfaceQueue<T extends Queueable>- Overrides:
initializein classInMemoryQueue<T extends Queueable>- 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. -
add
Description copied from interface:QueueAdd 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_MARKERand size of file grONE_MEG.- Returns:
- false if entry doesn't append to file.
-
shutdown
public void shutdown()Description copied from interface:QueueGracefully shutdowns queue.
-