public class MMFIndexedMessageStorage extends AbstractFileMessageStorage
WARNING: This implementation used class which is Sun proprietary API(HotSpot VM).
WARNING: Can persist message with sequence number is not greater than 178,956,969.
User: Mykhailo_Sereda Date: 16.05.12 Time: 11:38Modifier and Type | Field and Description |
---|---|
protected long |
channelLength |
protected long |
channelPosition |
protected byte[] |
dateFormattedBuffer |
protected int |
indexGrowSize |
static int |
MAX_SEQNUM |
protected int |
storageGrowSize |
protected long |
timestamp |
protected boolean |
timestampsInLogs |
accessFile, channel, configuration, isForcedFlush, maskedTags, NEW_LINE, storageTimestamp
Constructor and Description |
---|
MMFIndexedMessageStorage(com.epam.fixengine.configuration.Configuration config) |
Modifier and Type | Method and Description |
---|---|
void |
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 storage
|
protected long |
appendMessageToFile(long timestamp,
byte[] timestampFormatted,
byte[] message,
int offset,
int length) |
protected void |
backupStorageFile(String fullPathToStorageFile,
String fullPathToDestinationBackupFile)
Backups storage file.
|
void |
close()
Close the storage.
|
protected void |
deleteStorageFile(String fullPathToStorageFile)
Deletes storage file.
|
protected int |
getFormatLength() |
protected long |
getLastStoragePosition() |
protected long |
getNextSequenceNumber()
Gets next sequence number.
|
long |
initialize()
Opens the indexed file.
|
protected byte[] |
readFromStorage(FileChannel readChannel,
long readFrom,
int msgLen) |
void |
retrieveMessages(long from,
long to,
MessageStorageListener listener,
boolean blocking)
Retrieves message from storage.
|
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, deleteFile, getFile, getPrefixFormat, initialized, isClosed, openStorage, openStorageFile, retrieveMessage, setBackupFileLocator, setFile, setFileLocator
public static final int MAX_SEQNUM
protected long timestamp
protected byte[] dateFormattedBuffer
protected boolean timestampsInLogs
protected int storageGrowSize
protected long channelPosition
protected long channelLength
protected int indexGrowSize
public MMFIndexedMessageStorage(com.epam.fixengine.configuration.Configuration config)
public long initialize() throws IOException
initialize
in interface MessageStorage
initialize
in class AbstractFileMessageStorage
IOException
- - if I/O errors occurredAbstractFileMessageStorage.initialize()
protected int getFormatLength()
getFormatLength
in class AbstractFileMessageStorage
public void appendMessage(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException
MessageStorage
timestampFormatted
- the message timestampmessage
- the messageoffset
- the initial offsetlength
- the lengthIOException
- - if error occurred.public void appendMessage(byte[] timestampFormatted, byte[] message) throws IOException
MessageStorage
timestampFormatted
- the message timestampFormattedmessage
- the messageIOException
- - if error occurred.public long appendMessageInternal(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException
IOException
public long appendMessageInternal(long timestamp, byte[] message, int offset, int length) throws IOException
AbstractFileMessageStorage
appendMessageInternal
in class AbstractFileMessageStorage
timestamp
- the timestamp parametermessage
- the array of byteslength
- @throws IOException - if I/O error occurredIOException
AbstractFileMessageStorage.appendMessageInternal(long, byte[], int, int)
public void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) throws IOException
retrieveMessages
in interface MessageStorage
retrieveMessages
in class AbstractFileMessageStorage
from
- the start sequence positionto
- the end sequence positionlistener
- the callback listenerblocking
- if sets to true the method call not blockingjava.io.IOException,
- IllegalArgumentExceptionIOException
- - if error occurred.FlatFileMessageStorage
protected byte[] readFromStorage(FileChannel readChannel, long readFrom, int msgLen) throws IOException
IOException
protected long appendMessageToFile(long timestamp, byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException
IOException
protected long getNextSequenceNumber() throws IOException
AbstractFileMessageStorage
getNextSequenceNumber
in class AbstractFileMessageStorage
IOException
- - if I/O error occurredAbstractFileMessageStorage.getNextSequenceNumber()
protected long getLastStoragePosition() throws IOException
IOException
protected void backupStorageFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile) throws IOException
AbstractFileMessageStorage
backupStorageFile
in class AbstractFileMessageStorage
fullPathToStorageFile
- the path to file of in/out filefullPathToDestinationBackupFile
- the destination place to backup fileIOException
protected void deleteStorageFile(String fullPathToStorageFile)
AbstractFileMessageStorage
deleteStorageFile
in class AbstractFileMessageStorage
fullPathToStorageFile
- the path to in/out filepublic void close() throws IOException
close
in interface MessageStorage
close
in class AbstractFileMessageStorage
IOException
- - if I/O error occurredCopyright © 2000–2022 EPAM Systems. All rights reserved.