Package com.epam.fixengine.storage.file
Class FlatFileMessageStorage
java.lang.Object
com.epam.fixengine.storage.file.AbstractFileMessageStorage
com.epam.fixengine.storage.file.FlatFileMessageStorage
- All Implemented Interfaces:
MessageStorage
- Direct Known Subclasses:
IndexedMessageStorage
,MMFMessageStorage
,SlicedFileMessageStorage
File message storage implementation.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ByteBuffer
protected long
protected long
protected byte[]
protected static final long
protected int
protected int
protected boolean
protected long
protected boolean
protected static final int
Fields inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
accessFile, channel, configuration, isForcedFlush, maskedTags, NEW_LINE, storageTimestamp
-
Constructor Summary
ConstructorDescriptionDeprecated.FlatFileMessageStorage
(com.epam.fixengine.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendMessage
(byte[] timestampFormatted, byte[] message) Appends message to storage with the given formatted timestampFormatted.void
appendMessage
(byte[] timestampFormatted, byte[] message, int offset, int length) Appends message to storage with the given formatted timestamp.long
appendMessageInternal
(byte[] timestampFormatted, byte[] message, int offset, int length) long
appendMessageInternal
(long timestamp, byte[] message, int offset, int length) Appends message to storageprotected long
Gets next sequence number.boolean
protected void
void
retrieveMessages
(long from, long to, MessageStorageListener listener, boolean blocking) The methodretrieveMessages
is not supported in this instance.static long
retrieveSequenceNumber
(String fileName) Retrieves the last sequence number.Methods inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, backupStorageFile, close, deleteFile, deleteStorageFile, getFile, getFormatLength, getPrefixFormat, initialize, initialized, isClosed, openStorage, retrieveMessage, setBackupFileLocator, setFile, setFileLocator
-
Field Details
-
DELTA
protected static final long DELTA- See Also:
-
WRITE_BUFFER_LENGTH_DEF
protected static final int WRITE_BUFFER_LENGTH_DEF- See Also:
-
dateFormattedBuffer
protected byte[] dateFormattedBuffer -
buffer
-
maxBufferSize
protected int maxBufferSize -
timestamp
protected long timestamp -
timestampsInLogs
protected boolean timestampsInLogs -
maxStorageGrowSize
protected int maxStorageGrowSize -
storageGrowSize
protected boolean storageGrowSize -
channelPosition
protected long channelPosition -
channelLength
protected long channelLength
-
-
Constructor Details
-
FlatFileMessageStorage
Deprecated.CreatesFlatFileMessageStorage
. -
FlatFileMessageStorage
public FlatFileMessageStorage(com.epam.fixengine.configuration.Configuration config)
-
-
Method Details
-
openStorageFile
- Overrides:
openStorageFile
in classAbstractFileMessageStorage
- Throws:
IOException
-
retrieveMessages
public void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) throws IOException The methodretrieveMessages
is not supported in this instance.- Specified by:
retrieveMessages
in interfaceMessageStorage
- Specified by:
retrieveMessages
in classAbstractFileMessageStorage
- Parameters:
from
- the from sequence numberto
- the to sequence numberlistener
- the callback listenerblocking
- if parameter is true, the execution start in current thread context, otherwise in the new thread context.- Throws:
IOException
- - Message retrieval is not possible for flat files- See Also:
-
getNextSequenceNumber
Description copied from class:AbstractFileMessageStorage
Gets next sequence number.- Specified by:
getNextSequenceNumber
in classAbstractFileMessageStorage
- Throws:
IOException
- - if I/O error occurred
-
appendMessage
public void appendMessage(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException Description copied from interface:MessageStorage
Appends message to storage with the given formatted timestamp.- Parameters:
timestampFormatted
- the message timestampmessage
- the messageoffset
- the initial offsetlength
- the length- Throws:
IOException
- - if error occurred.
-
appendMessage
Description copied from interface:MessageStorage
Appends message to storage with the given formatted timestampFormatted.- Parameters:
timestampFormatted
- the message timestampFormattedmessage
- the message- Throws:
IOException
- - if error occurred.
-
appendMessageInternal
public long appendMessageInternal(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException - Throws:
IOException
-
appendMessageInternal
public long appendMessageInternal(long timestamp, byte[] message, int offset, int length) throws IOException Appends message to storage- Specified by:
appendMessageInternal
in classAbstractFileMessageStorage
- Parameters:
timestamp
- the timestamp parametermessage
- the array of bytesoffset
-length
-- Throws:
IOException
- - if I/O error occurred
-
isEnabledTimestamp
public boolean isEnabledTimestamp() -
retrieveSequenceNumber
Retrieves the last sequence number.- Parameters:
fileName
- the file name- Throws:
IOException
- - if I/O error occurred
-