Search in sources :

Example 6 with JournalAddRecordTX

use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.

the class JournalCompactor method onReadUpdateRecordTX.

@Override
public void onReadUpdateRecordTX(final long transactionID, final RecordInfo info) throws Exception {
    if (logger.isTraceEnabled()) {
        logger.trace("onReadUpdateRecordTX " + info);
    }
    if (pendingTransactions.get(transactionID) != null || lookupRecord(info.id)) {
        JournalTransaction newTransaction = getNewJournalTransaction(transactionID);
        JournalInternalRecord updateRecordTX = new JournalAddRecordTX(false, transactionID, info.id, info.userRecordType, EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));
        updateRecordTX.setCompactCount((short) (info.compactCount + 1));
        checkSize(updateRecordTX.getEncodeSize(), info.compactCount);
        writeEncoder(updateRecordTX);
        newTransaction.addPositive(currentFile, info.id, updateRecordTX.getEncodeSize());
    } else {
        onReadUpdateRecord(info);
    }
}
Also used : ByteArrayEncoding(org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding) JournalAddRecordTX(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Aggregations

JournalAddRecordTX (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX)6 JournalInternalRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)6 IOException (java.io.IOException)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 ByteArrayEncoding (org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding)2