Search in sources :

Example 6 with JournalAddRecord

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

the class FileWrapperJournal method appendUpdateRecord.

@Override
public void appendUpdateRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion callback) throws Exception {
    JournalInternalRecord updateRecord = new JournalAddRecord(false, id, recordType, persister, record);
    writeRecord(updateRecord, false, -1, false, callback);
}
Also used : JournalAddRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecord) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Example 7 with JournalAddRecord

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

the class JournalCompactor method onReadAddRecord.

// JournalReaderCallback implementation -------------------------------------------
@Override
public void onReadAddRecord(final RecordInfo info) throws Exception {
    if (logger.isTraceEnabled()) {
        logger.trace("Read Record " + info);
    }
    if (lookupRecord(info.id)) {
        JournalInternalRecord addRecord = new JournalAddRecord(true, info.id, info.getUserRecordType(), EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));
        addRecord.setCompactCount((short) (info.compactCount + 1));
        checkSize(addRecord.getEncodeSize(), info.compactCount);
        writeEncoder(addRecord);
        newRecords.put(info.id, new JournalRecord(currentFile, addRecord.getEncodeSize()));
    }
}
Also used : JournalAddRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecord) ByteArrayEncoding(org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Aggregations

JournalAddRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecord)7 JournalInternalRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)7 ByteArrayEncoding (org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)1