Search in sources :

Example 1 with JournalDeleteRecordTX

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

the class JournalImpl method appendDeleteRecordTransactional.

@Override
public void appendDeleteRecordTransactional(final long txID, final long id, final EncodingSupport record) throws Exception {
    if (logger.isTraceEnabled()) {
        logger.trace("scheduling appendDeleteRecordTransactional::txID=" + txID + ", id=" + id);
    }
    checkJournalIsLoaded();
    appendExecutor.execute(new Runnable() {

        @Override
        public void run() {
            journalLock.readLock().lock();
            final JournalTransaction tx = getTransactionInfo(txID);
            try {
                if (tx != null) {
                    tx.checkErrorCondition();
                }
                JournalInternalRecord deleteRecordTX = new JournalDeleteRecordTX(txID, id, record);
                JournalFile usedFile = appendRecord(deleteRecordTX, false, false, tx, null);
                if (logger.isTraceEnabled()) {
                    logger.trace("appendDeleteRecordTransactional::txID=" + txID + ", id=" + id + ", usedFile = " + usedFile);
                }
                tx.addNegative(usedFile, id);
            } catch (Exception e) {
                logger.error("appendDeleteRecordTransactional:" + e, e);
                setErrorCondition(null, tx, e);
            } finally {
                journalLock.readLock().unlock();
            }
        }
    });
}
Also used : JournalDeleteRecordTX(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) IOException(java.io.IOException) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Example 2 with JournalDeleteRecordTX

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

the class FileWrapperJournal method appendDeleteRecordTransactional.

@Override
public void appendDeleteRecordTransactional(long txID, long id, EncodingSupport record) throws Exception {
    JournalInternalRecord deleteRecordTX = new JournalDeleteRecordTX(txID, id, record);
    writeRecord(deleteRecordTX, false, txID, false, null);
}
Also used : JournalDeleteRecordTX(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX) JournalInternalRecord(org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)

Example 3 with JournalDeleteRecordTX

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

Aggregations

JournalDeleteRecordTX (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX)3 JournalInternalRecord (org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord)3 IOException (java.io.IOException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 ByteArrayEncoding (org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding)1