Interface Journal
- All Superinterfaces:
ActiveMQComponent
- All Known Subinterfaces:
TestableJournal
- All Known Implementing Classes:
FileWrapperJournal,JDBCJournalImpl,JournalImpl,ReplicatedJournal
Most methods on the journal provide a blocking version where you select the sync mode and a non blocking mode where
you pass a completion callback as a parameter.
Notice also that even on the callback methods it's possible to pass the sync mode. That will only make sense on the NIO operations.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAddEvent(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) An event is data recorded on the journal, but it won't have any weight or deletes.voidappendAddRecord(long id, byte recordType, byte[] record, boolean sync) default voidappendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync) default voidappendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) voidappendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync) voidappendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) voidappendAddRecordTransactional(long txID, long id, byte recordType, byte[] record) default voidappendAddRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) voidappendAddRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) voidappendCommitRecord(long txID, boolean sync) voidappendCommitRecord(long txID, boolean sync, IOCompletion callback) voidappendCommitRecord(long txID, boolean sync, IOCompletion callback, boolean lineUpContext) append a commit record to thisJournalimplementationvoidappendDeleteRecord(long id, boolean sync) voidappendDeleteRecord(long id, boolean sync, IOCompletion completionCallback) voidappendDeleteRecordTransactional(long txID, long id) voidappendDeleteRecordTransactional(long txID, long id, byte[] record) voidappendDeleteRecordTransactional(long txID, long id, EncodingSupport record) voidappendPrepareRecord(long txID, byte[] transactionData, boolean sync) voidappendPrepareRecord(long txID, EncodingSupport transactionData, boolean sync) If the system crashed after a prepare was called, it should store information that is required to bring the transaction back to a state it could be committed.voidappendPrepareRecord(long txID, EncodingSupport transactionData, boolean sync, IOCompletion callback) voidappendRollbackRecord(long txID, boolean sync) voidappendRollbackRecord(long txID, boolean sync, IOCompletion callback) voidappendUpdateRecord(long id, byte recordType, byte[] record, boolean sync) default voidappendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync) default voidappendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) voidappendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync) voidappendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion callback) voidappendUpdateRecordTransactional(long txID, long id, byte recordType, byte[] record) default voidappendUpdateRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) voidappendUpdateRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) createFilesForBackupSync(long[] fileIds) Reserves journal file IDs, creates the necessary files for synchronization, and places references to these (reserved for sync) files in the map.voidflush()It will make sure there are no more pending operations on the Executors.default voidforceBackup(int timeout, TimeUnit unit) voidForce the usage of a newJournalFile.intdefault IOCriticalErrorListenerReturns array with allJournalFiles in use.intdefault FilelongReturns the max size record that can be stored in the journal.intintlongdefault booleanbooleanvoidlineUpContext(IOCompletion callback) default JournalLoadInformationload(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure) load(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure, boolean fixBadTx) load(LoaderCallback reloadManager) default JournalLoadInformationload(SparseArrayLinkedList<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure) load(SparseArrayLinkedList<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure, boolean fixBadTx) Load internal data structures and not expose any data.loadSyncOnly(Journal.JournalState state) Load internal data structures, and remain waiting for synchronization to complete.default voidIt will rename temporary files and place them on the copy folder, by resotring the original file name.default voidIt will check max files and max days on files and remove extra files.default voidreplaceableRecord(byte recordType) voidRestarts file reclaim and compacting on the journal.voidStops any operation that may delete or modify old (stale) data.voidscheduleCompactAndBlock(int timeout) This method will start compact using the compactorExecutor and block up to timeout secondsdefault JournalsetCriticalErrorListener(IOCriticalErrorListener criticalErrorListener) default JournalsetHistoryFolder(File historyFolder, long maxBytes, long period) voidsetRemoveExtraFilesOnLoad(boolean removeExtraFilesOnLoad) voidWrite lock the Journal and write lock the compacting process.voidUnlock the Journal and the compacting process.voidtryAppendDeleteRecord(long id, boolean sync, JournalUpdateCallback updateCallback, IOCompletion completionCallback) voidtryAppendDeleteRecord(long id, JournalUpdateCallback updateCallback, boolean sync) voidtryAppendUpdateRecord(long id, byte recordType, byte[] record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableRecord) default voidtryAppendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync, boolean replaceableUpdate, JournalUpdateCallback updateCallback, IOCompletion completionCallback) default voidtryAppendUpdateRecord(long id, byte recordType, EncodingSupport record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableRecord) voidtryAppendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync, boolean replaceableUpdate, JournalUpdateCallback updateCallback, IOCompletion callback) voidtryAppendUpdateRecord(long id, byte recordType, Persister persister, Object record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableUpdate) Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop, isStarted, start, stop
-
Method Details
-
setRemoveExtraFilesOnLoad
void setRemoveExtraFilesOnLoad(boolean removeExtraFilesOnLoad) -
isRemoveExtraFilesOnLoad
boolean isRemoveExtraFilesOnLoad() -
isHistory
default boolean isHistory() -
appendAddRecord
- Throws:
Exception
-
appendAddRecord
default void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception - Throws:
Exception
-
setHistoryFolder
- Throws:
Exception
-
getHistoryFolder
-
appendAddRecord
void appendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync) throws Exception - Throws:
Exception
-
appendAddRecord
void appendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) throws Exception - Throws:
Exception
-
appendAddEvent
void appendAddEvent(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) throws Exception An event is data recorded on the journal, but it won't have any weight or deletes. It's always ready to be removed. It is useful on recovery data while in use with backup history journal.- Throws:
Exception
-
appendAddRecord
default void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) throws Exception - Throws:
Exception
-
replaceableRecord
default void replaceableRecord(byte recordType) -
appendUpdateRecord
- Throws:
Exception
-
tryAppendUpdateRecord
void tryAppendUpdateRecord(long id, byte recordType, byte[] record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableRecord) throws Exception - Throws:
Exception
-
appendUpdateRecord
default void appendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception - Throws:
Exception
-
tryAppendUpdateRecord
default void tryAppendUpdateRecord(long id, byte recordType, EncodingSupport record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableRecord) throws Exception - Throws:
Exception
-
appendUpdateRecord
void appendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync) throws Exception - Throws:
Exception
-
tryAppendUpdateRecord
void tryAppendUpdateRecord(long id, byte recordType, Persister persister, Object record, JournalUpdateCallback updateCallback, boolean sync, boolean replaceableUpdate) throws Exception - Throws:
Exception
-
getCriticalErrorListener
-
setCriticalErrorListener
-
appendUpdateRecord
default void appendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) throws Exception - Throws:
Exception
-
tryAppendUpdateRecord
default void tryAppendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync, boolean replaceableUpdate, JournalUpdateCallback updateCallback, IOCompletion completionCallback) throws Exception - Throws:
Exception
-
appendUpdateRecord
void appendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion callback) throws Exception - Throws:
Exception
-
tryAppendUpdateRecord
void tryAppendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync, boolean replaceableUpdate, JournalUpdateCallback updateCallback, IOCompletion callback) throws Exception - Throws:
Exception
-
appendDeleteRecord
- Throws:
Exception
-
tryAppendDeleteRecord
void tryAppendDeleteRecord(long id, JournalUpdateCallback updateCallback, boolean sync) throws Exception - Throws:
Exception
-
appendDeleteRecord
- Throws:
Exception
-
tryAppendDeleteRecord
void tryAppendDeleteRecord(long id, boolean sync, JournalUpdateCallback updateCallback, IOCompletion completionCallback) throws Exception - Throws:
Exception
-
appendAddRecordTransactional
void appendAddRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception - Throws:
Exception
-
appendAddRecordTransactional
default void appendAddRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception - Throws:
Exception
-
appendAddRecordTransactional
void appendAddRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) throws Exception - Throws:
Exception
-
appendUpdateRecordTransactional
void appendUpdateRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception - Throws:
Exception
-
appendUpdateRecordTransactional
default void appendUpdateRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception - Throws:
Exception
-
appendUpdateRecordTransactional
void appendUpdateRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) throws Exception - Throws:
Exception
-
appendDeleteRecordTransactional
- Throws:
Exception
-
appendDeleteRecordTransactional
- Throws:
Exception
-
appendDeleteRecordTransactional
- Throws:
Exception
-
appendCommitRecord
- Throws:
Exception
-
appendCommitRecord
- Throws:
Exception
-
appendCommitRecord
void appendCommitRecord(long txID, boolean sync, IOCompletion callback, boolean lineUpContext) throws Exception append a commit record to thisJournalimplementation- Parameters:
lineUpContext- if appendCommitRecord should call a storeLineUp. This is because the caller may have already taken into account- Throws:
Exception
-
appendPrepareRecord
If the system crashed after a prepare was called, it should store information that is required to bring the transaction back to a state it could be committed.- Parameters:
transactionData- allows you to store any extra supporting user-data related to the transaction- Throws:
Exception
-
appendPrepareRecord
void appendPrepareRecord(long txID, EncodingSupport transactionData, boolean sync, IOCompletion callback) throws Exception - Throws:
Exception
-
appendPrepareRecord
- Throws:
Exception
-
appendRollbackRecord
- Throws:
Exception
-
appendRollbackRecord
- Throws:
Exception
-
load
- Throws:
Exception
-
loadInternalOnly
Load internal data structures and not expose any data. This is only useful if you're using the journal but not interested on the current data. Useful in situations where the journal is being replicated, copied... etc.- Throws:
Exception
-
loadSyncOnly
Load internal data structures, and remain waiting for synchronization to complete.- Parameters:
state- the current state of the journal, this parameter ensures consistency.- Throws:
Exception
-
lineUpContext
-
load
default JournalLoadInformation load(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure) throws Exception - Throws:
Exception
-
load
JournalLoadInformation load(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure, boolean fixBadTx) throws Exception - Throws:
Exception
-
load
default JournalLoadInformation load(SparseArrayLinkedList<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure) throws Exception - Throws:
Exception
-
load
JournalLoadInformation load(SparseArrayLinkedList<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure, boolean fixBadTx) throws Exception - Throws:
Exception
-
getAlignment
- Throws:
Exception
-
getNumberOfRecords
int getNumberOfRecords() -
getUserVersion
int getUserVersion() -
createFilesForBackupSync
Reserves journal file IDs, creates the necessary files for synchronization, and places references to these (reserved for sync) files in the map.During the synchronization between a replicating server and replica, we reserve in the replica the journal file IDs used in the replicating server. This call also makes sure the files are created empty without any kind of headers added.
- Parameters:
fileIds- IDs to reserve for synchronization- Returns:
- map to be filled with id and journal file pairs for synchronization
- Throws:
Exception
-
synchronizationLock
void synchronizationLock()Write lock the Journal and write lock the compacting process. Necessary only during replication for backup synchronization. -
synchronizationUnlock
void synchronizationUnlock()Unlock the Journal and the compacting process.- See Also:
-
processBackup
default void processBackup()It will rename temporary files and place them on the copy folder, by resotring the original file name. -
processBackupCleanup
default void processBackupCleanup()It will check max files and max days on files and remove extra files. -
forceMoveNextFile
Force the usage of a newJournalFile.- Throws:
Exception
-
forceBackup
- Throws:
Exception
-
getDataFiles
JournalFile[] getDataFiles()Returns array with allJournalFiles in use.- Returns:
- array with all
JournalFiles in use
-
getFileFactory
SequentialFileFactory getFileFactory() -
getFileSize
int getFileSize() -
scheduleCompactAndBlock
This method will start compact using the compactorExecutor and block up to timeout seconds- Parameters:
timeout- the timeout in seconds or block forever if<= 0- Throws:
Exception
-
replicationSyncPreserveOldFiles
void replicationSyncPreserveOldFiles()Stops any operation that may delete or modify old (stale) data.Meant to be used during synchronization of data between a replicating server and its replica. Old files must not be compacted or deleted during synchronization.
-
replicationSyncFinished
void replicationSyncFinished()Restarts file reclaim and compacting on the journal.Meant to be used to revert the effect of
replicationSyncPreserveOldFiles(). it should only be called once the synchronization of the replica and replicating servers is completed. -
flush
It will make sure there are no more pending operations on the Executors.- Throws:
Exception
-
getMaxRecordSize
long getMaxRecordSize()Returns the max size record that can be stored in the journal.- Returns:
- the max size record that can be stored in the journal
-
getWarningRecordSize
long getWarningRecordSize()
-