Search in sources :

Example 6 with ByteArrayEncoding

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

the class JournalCompactor method onReadDeleteRecordTX.

@Override
public void onReadDeleteRecordTX(final long transactionID, final RecordInfo info) throws Exception {
    if (logger.isTraceEnabled()) {
        logger.trace("onReadDeleteRecordTX " + transactionID + " info " + info);
    }
    if (pendingTransactions.get(transactionID) != null) {
        JournalTransaction newTransaction = getNewJournalTransaction(transactionID);
        JournalInternalRecord record = new JournalDeleteRecordTX(transactionID, info.id, new ByteArrayEncoding(info.data));
        checkSize(record.getEncodeSize());
        writeEncoder(record);
        newTransaction.addNegative(currentFile, info.id);
    }
// else.. nothing to be done
}
Also used : ByteArrayEncoding(org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding) JournalDeleteRecordTX(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Example 7 with ByteArrayEncoding

use of org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding 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

ByteArrayEncoding (org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding)7 JournalInternalRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)7 JournalAddRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecord)3 JournalAddRecordTX (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX)2 ByteBuffer (java.nio.ByteBuffer)1 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)1 JournalCompleteRecordTX (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalCompleteRecordTX)1 JournalDeleteRecordTX (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX)1