public abstract class AbstractFileMessageStorage extends Object implements MessageStorage
Modifier and Type | Field and Description |
---|---|
protected RandomAccessFile |
accessFile |
protected FileChannel |
channel |
protected com.epam.fixengine.configuration.Configuration |
configuration |
protected boolean |
isForcedFlush |
protected Map<byte[],Set<Integer>> |
maskedTags |
protected static byte[] |
NEW_LINE |
protected StorageTimestamp |
storageTimestamp |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFileMessageStorage()
Deprecated.
|
protected |
AbstractFileMessageStorage(com.epam.fixengine.configuration.Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
appendMessage(byte[] message)
Appends message to storage.
|
void |
appendMessage(byte[] message,
int offset,
int length)
Appends message to storage.
|
long |
appendMessageInternal(Date date,
byte[] message,
int offset,
int length)
Deprecated.
|
abstract long |
appendMessageInternal(long timestamp,
byte[] message,
int offset,
int length)
Appends message to storage
|
protected void |
backupFile(String fullPathToStorageFile,
String fullPathToDestinationBackupFile) |
void |
backupStorage(SessionParameters sessionParameters)
Backup the storage.
|
protected void |
backupStorageFile(String fullPathToStorageFile,
String fullPathToDestinationBackupFile)
Backups storage file.
|
void |
close()
Close the storage.
|
protected void |
deleteFile(String fullPathToStorageFile) |
protected void |
deleteStorageFile(String fullPathToStorageFile)
Deletes storage file.
|
String |
getFile()
Gets the file.
|
protected int |
getFormatLength() |
protected abstract long |
getNextSequenceNumber()
Gets next sequence number.
|
protected byte[] |
getPrefixFormat(long timestamp) |
long |
initialize()
Initialize the storage.
|
protected boolean |
initialized() |
protected boolean |
isClosed()
Returns true if storage is closed.
|
protected void |
openStorage() |
protected void |
openStorageFile() |
byte[] |
retrieveMessage(long num)
Retrieves message from storage.
|
abstract void |
retrieveMessages(long from,
long to,
MessageStorageListener listener,
boolean blocking)
Retrieves message from storage.
|
void |
setBackupFileLocator(LogFileLocator fileLocator) |
void |
setFile(String file)
Sets the file.
|
void |
setFileLocator(LogFileLocator fileLocator) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessage, appendMessage
protected static final byte[] NEW_LINE
protected FileChannel channel
protected RandomAccessFile accessFile
protected com.epam.fixengine.configuration.Configuration configuration
protected StorageTimestamp storageTimestamp
protected boolean isForcedFlush
@Deprecated protected AbstractFileMessageStorage()
protected AbstractFileMessageStorage(com.epam.fixengine.configuration.Configuration configuration)
protected int getFormatLength()
protected byte[] getPrefixFormat(long timestamp)
public String getFile()
public void setFile(String file)
file
- the filepublic void setFileLocator(LogFileLocator fileLocator)
public void setBackupFileLocator(LogFileLocator fileLocator)
public abstract void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) throws IOException
MessageStorage
retrieveMessages
in interface MessageStorage
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.IOException
- - if error occurred.MessageStorage.retrieveMessages(long, long, com.epam.fixengine.storage.MessageStorageListener, boolean)
public byte[] retrieveMessage(long num) throws IOException
MessageStorage
retrieveMessage
in interface MessageStorage
num
- the sequence number of messageIOException
- - if error occurred.MessageStorage.retrieveMessage(long)
public long initialize() throws IOException
initialize
in interface MessageStorage
IOException
- - if I/O error occurredprotected void openStorageFile() throws IOException
IOException
protected boolean initialized()
protected abstract long getNextSequenceNumber() throws IOException
IOException
- - if I/O error occurredpublic void appendMessage(byte[] message, int offset, int length) throws IOException
MessageStorage
appendMessage
in interface MessageStorage
message
- the messageoffset
- the initial offsetlength
- the lengthIOException
- - if error occurred.public void appendMessage(byte[] message) throws IOException
MessageStorage
appendMessage
in interface MessageStorage
message
- the messageIOException
- - if error occurred.MessageStorage.appendMessage(byte[])
@Deprecated public long appendMessageInternal(Date date, byte[] message, int offset, int length) throws IOException
date
- the date parametermessage
- the array of bytesoffset
- length
- @throws IOException - if I/O error occurredIOException
public abstract long appendMessageInternal(long timestamp, byte[] message, int offset, int length) throws IOException
timestamp
- the timestamp parametermessage
- the array of bytesoffset
- length
- @throws IOException - if I/O error occurredIOException
public void backupStorage(SessionParameters sessionParameters) throws IOException
MessageStorage
backupStorage
in interface MessageStorage
sessionParameters
- the session parametersIOException
protected void openStorage()
protected void backupStorageFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile) throws IOException
fullPathToStorageFile
- the path to file of in/out filefullPathToDestinationBackupFile
- the destination place to backup fileIOException
protected void backupFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile) throws IOException
IOException
protected void deleteStorageFile(String fullPathToStorageFile)
fullPathToStorageFile
- the path to in/out fileprotected void deleteFile(String fullPathToStorageFile)
public void close() throws IOException
close
in interface MessageStorage
IOException
- - if I/O error occurredprotected boolean isClosed()
Copyright © 2000–2022 EPAM Systems. All rights reserved.