public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
Journal.JournalStateconnection, sqlProvider| Constructor and Description |
|---|
JDBCJournalImpl(DataSource dataSource,
SQLProvider provider,
String tableName,
ScheduledExecutorService scheduledExecutorService,
Executor completeExecutor,
IOCriticalErrorListener criticalIOErrorListener) |
JDBCJournalImpl(String jdbcUrl,
String jdbcDriverClass,
SQLProvider sqlProvider,
ScheduledExecutorService scheduledExecutorService,
Executor completeExecutor,
IOCriticalErrorListener criticalIOErrorListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendAddRecord(long id,
byte recordType,
byte[] record,
boolean sync) |
void |
appendAddRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync) |
void |
appendAddRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync,
IOCompletion completionCallback) |
void |
appendAddRecordTransactional(long txID,
long id,
byte recordType,
byte[] record) |
void |
appendAddRecordTransactional(long txID,
long id,
byte recordType,
EncodingSupport record) |
void |
appendCommitRecord(long txID,
boolean sync) |
void |
appendCommitRecord(long txID,
boolean sync,
IOCompletion callback) |
void |
appendCommitRecord(long txID,
boolean sync,
IOCompletion callback,
boolean lineUpContext) |
void |
appendDeleteRecord(long id,
boolean sync) |
void |
appendDeleteRecord(long id,
boolean sync,
IOCompletion completionCallback) |
void |
appendDeleteRecordTransactional(long txID,
long id) |
void |
appendDeleteRecordTransactional(long txID,
long id,
byte[] record) |
void |
appendDeleteRecordTransactional(long txID,
long id,
EncodingSupport record) |
void |
appendPrepareRecord(long txID,
byte[] transactionData,
boolean sync) |
void |
appendPrepareRecord(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.
|
void |
appendPrepareRecord(long txID,
EncodingSupport transactionData,
boolean sync,
IOCompletion callback) |
void |
appendRollbackRecord(long txID,
boolean sync) |
void |
appendRollbackRecord(long txID,
boolean sync,
IOCompletion callback) |
void |
appendUpdateRecord(long id,
byte recordType,
byte[] record,
boolean sync) |
void |
appendUpdateRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync) |
void |
appendUpdateRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync,
IOCompletion completionCallback) |
void |
appendUpdateRecordTransactional(long txID,
long id,
byte recordType,
byte[] record) |
void |
appendUpdateRecordTransactional(long txID,
long id,
byte recordType,
EncodingSupport record) |
Map<Long,JournalFile> |
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.
|
protected void |
createSchema() |
void |
destroy() |
void |
flush()
It will make sure there are no more pending operations on the Executors.
|
void |
forceMoveNextFile()
Force the usage of a new
JournalFile. |
int |
getAlignment() |
JournalFile[] |
getDataFiles()
Returns the
JournalFiles in use. |
SequentialFileFactory |
getFileFactory() |
int |
getFileSize() |
int |
getNumberOfRecords() |
int |
getUserVersion() |
void |
handleException(List<org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalRecord> recordRef,
Throwable e)
public for tests only, not through API
|
boolean |
isStarted() |
void |
lineUpContext(IOCompletion callback) |
JournalLoadInformation |
load(List<RecordInfo> committedRecords,
List<PreparedTransactionInfo> preparedTransactions,
TransactionFailureCallback transactionFailure) |
JournalLoadInformation |
load(List<RecordInfo> committedRecords,
List<PreparedTransactionInfo> preparedTransactions,
TransactionFailureCallback failureCallback,
boolean fixBadTX) |
JournalLoadInformation |
load(LoaderCallback reloadManager) |
JournalLoadInformation |
loadInternalOnly()
Load internal data structures and not expose any data.
|
JournalLoadInformation |
loadSyncOnly(Journal.JournalState state)
Load internal data structures, and remain waiting for synchronization to complete.
|
void |
perfBlast(int pages) |
protected void |
prepareStatements() |
void |
replicationSyncFinished()
Restarts file reclaim and compacting on the journal.
|
void |
replicationSyncPreserveOldFiles()
Stops any operation that may delete or modify old (stale) data.
|
void |
runDirectJournalBlast() |
void |
scheduleCompactAndBlock(int timeout)
This method will start compact using the compactorExecutor and block up to timeout seconds
|
void |
start() |
void |
stop() |
void |
stop(boolean sync) |
int |
sync() |
void |
synchronizationLock()
Write lock the Journal and write lock the compacting process.
|
void |
synchronizationUnlock()
Unlock the Journal and the compacting process.
|
createTable, getConnection, setConnection, setDataSource, setJdbcConnectionUrl, setJdbcDriverClass, setNetworkTimeout, setSqlProviderpublic JDBCJournalImpl(DataSource dataSource, SQLProvider provider, String tableName, ScheduledExecutorService scheduledExecutorService, Executor completeExecutor, IOCriticalErrorListener criticalIOErrorListener)
public JDBCJournalImpl(String jdbcUrl, String jdbcDriverClass, SQLProvider sqlProvider, ScheduledExecutorService scheduledExecutorService, Executor completeExecutor, IOCriticalErrorListener criticalIOErrorListener)
public void start()
throws SQLException
start in interface ActiveMQComponentstart in class AbstractJDBCDriverSQLExceptionpublic void flush()
throws Exception
Journalprotected void createSchema()
throws SQLException
createSchema in class AbstractJDBCDriverSQLExceptionprotected void prepareStatements()
throws SQLException
prepareStatements in class AbstractJDBCDriverSQLExceptionpublic void stop()
throws SQLException
stop in interface ActiveMQComponentstop in class AbstractJDBCDriverSQLExceptionpublic void stop(boolean sync)
throws SQLException
SQLExceptionpublic void destroy()
throws Exception
destroy in class AbstractJDBCDriverExceptionpublic int sync()
public void handleException(List<org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalRecord> recordRef, Throwable e)
public void appendAddRecord(long id,
byte recordType,
byte[] record,
boolean sync)
throws Exception
appendAddRecord in interface JournalExceptionpublic void appendAddRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync)
throws Exception
appendAddRecord in interface JournalExceptionpublic void appendAddRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync,
IOCompletion completionCallback)
throws Exception
appendAddRecord in interface JournalExceptionpublic void appendUpdateRecord(long id,
byte recordType,
byte[] record,
boolean sync)
throws Exception
appendUpdateRecord in interface JournalExceptionpublic void appendUpdateRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync)
throws Exception
appendUpdateRecord in interface JournalExceptionpublic void appendUpdateRecord(long id,
byte recordType,
EncodingSupport record,
boolean sync,
IOCompletion completionCallback)
throws Exception
appendUpdateRecord in interface JournalExceptionpublic void appendDeleteRecord(long id,
boolean sync)
throws Exception
appendDeleteRecord in interface JournalExceptionpublic void appendDeleteRecord(long id,
boolean sync,
IOCompletion completionCallback)
throws Exception
appendDeleteRecord in interface JournalExceptionpublic void appendAddRecordTransactional(long txID,
long id,
byte recordType,
byte[] record)
throws Exception
appendAddRecordTransactional in interface JournalExceptionpublic void appendAddRecordTransactional(long txID,
long id,
byte recordType,
EncodingSupport record)
throws Exception
appendAddRecordTransactional in interface JournalExceptionpublic void appendUpdateRecordTransactional(long txID,
long id,
byte recordType,
byte[] record)
throws Exception
appendUpdateRecordTransactional in interface JournalExceptionpublic void appendUpdateRecordTransactional(long txID,
long id,
byte recordType,
EncodingSupport record)
throws Exception
appendUpdateRecordTransactional in interface JournalExceptionpublic void appendDeleteRecordTransactional(long txID,
long id,
byte[] record)
throws Exception
appendDeleteRecordTransactional in interface JournalExceptionpublic void appendDeleteRecordTransactional(long txID,
long id,
EncodingSupport record)
throws Exception
appendDeleteRecordTransactional in interface JournalExceptionpublic void appendDeleteRecordTransactional(long txID,
long id)
throws Exception
appendDeleteRecordTransactional in interface JournalExceptionpublic void appendCommitRecord(long txID,
boolean sync)
throws Exception
appendCommitRecord in interface JournalExceptionpublic void appendCommitRecord(long txID,
boolean sync,
IOCompletion callback)
throws Exception
appendCommitRecord in interface JournalExceptionpublic void appendCommitRecord(long txID,
boolean sync,
IOCompletion callback,
boolean lineUpContext)
throws Exception
appendCommitRecord in interface JournallineUpContext - if appendCommitRecord should call a storeLineUp. This is because the
caller may have already taken into accountExceptionpublic void appendPrepareRecord(long txID,
EncodingSupport transactionData,
boolean sync)
throws Exception
JournalIf 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.
transactionData allows you to store any other supporting user-data related to the transaction
appendPrepareRecord in interface JournaltransactionData - - extra user data for the prepareExceptionpublic void appendPrepareRecord(long txID,
EncodingSupport transactionData,
boolean sync,
IOCompletion callback)
throws Exception
appendPrepareRecord in interface JournalExceptionpublic void appendPrepareRecord(long txID,
byte[] transactionData,
boolean sync)
throws Exception
appendPrepareRecord in interface JournalExceptionpublic void appendRollbackRecord(long txID,
boolean sync)
throws Exception
appendRollbackRecord in interface JournalExceptionpublic void appendRollbackRecord(long txID,
boolean sync,
IOCompletion callback)
throws Exception
appendRollbackRecord in interface JournalExceptionpublic JournalLoadInformation load(LoaderCallback reloadManager)
public JournalLoadInformation loadInternalOnly() throws Exception
JournalloadInternalOnly in interface JournalExceptionpublic JournalLoadInformation loadSyncOnly(Journal.JournalState state) throws Exception
JournalloadSyncOnly in interface Journalstate - the current state of the journal, this parameter ensures consistency.Exceptionpublic void lineUpContext(IOCompletion callback)
lineUpContext in interface Journalpublic JournalLoadInformation load(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback transactionFailure) throws Exception
public JournalLoadInformation load(List<RecordInfo> committedRecords, List<PreparedTransactionInfo> preparedTransactions, TransactionFailureCallback failureCallback, boolean fixBadTX) throws Exception
Exceptionpublic int getAlignment()
throws Exception
getAlignment in interface JournalExceptionpublic int getNumberOfRecords()
getNumberOfRecords in interface Journalpublic int getUserVersion()
getUserVersion in interface Journalpublic void runDirectJournalBlast()
throws Exception
runDirectJournalBlast in interface JournalExceptionpublic Map<Long,JournalFile> createFilesForBackupSync(long[] fileIds) throws Exception
JournalDuring the synchronization between a live server and backup, we reserve in the backup the journal file IDs used in the live server. This call also makes sure the files are created empty without any kind of headers added.
createFilesForBackupSync in interface JournalfileIds - IDs to reserve for synchronizationExceptionpublic final void synchronizationLock()
JournalsynchronizationLock in interface Journalpublic final void synchronizationUnlock()
JournalsynchronizationUnlock in interface JournalJournal.synchronizationLock()public void forceMoveNextFile()
throws Exception
JournalJournalFile.forceMoveNextFile in interface JournalExceptionpublic JournalFile[] getDataFiles()
JournalJournalFiles in use.getDataFiles in interface JournalJournalFiles in usepublic SequentialFileFactory getFileFactory()
getFileFactory in interface Journalpublic int getFileSize()
getFileSize in interface Journalpublic void scheduleCompactAndBlock(int timeout)
throws Exception
JournalscheduleCompactAndBlock in interface Journaltimeout - the timeout in seconds or block forever if <= 0Exceptionpublic void replicationSyncPreserveOldFiles()
JournalMeant to be used during synchronization of data between a live server and its replicating (remote) backup. Old files must not be compacted or deleted during synchronization.
replicationSyncPreserveOldFiles in interface Journalpublic void replicationSyncFinished()
Journal
Meant to be used to revert the effect of Journal.replicationSyncPreserveOldFiles(). it should
only be called once the synchronization of the backup and live servers is completed.
replicationSyncFinished in interface Journalpublic boolean isStarted()
isStarted in interface ActiveMQComponentCopyright © 2018 JBoss by Red Hat. All rights reserved.