use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.
the class JournalImpl method appendUpdateRecordTransactional.
@Override
public void appendUpdateRecordTransactional(final long txID, final long id, final byte recordType, final Persister persister, final Object record) throws Exception {
if (logger.isTraceEnabled()) {
logger.trace("scheduling appendUpdateRecordTransactional::txID=" + txID + ",id=" + id + ", userRecordType=" + recordType + ", record = " + record);
}
checkJournalIsLoaded();
appendExecutor.execute(new Runnable() {
@Override
public void run() {
journalLock.readLock().lock();
final JournalTransaction tx = getTransactionInfo(txID);
try {
tx.checkErrorCondition();
JournalInternalRecord updateRecordTX = new JournalAddRecordTX(false, txID, id, recordType, persister, record);
JournalFile usedFile = appendRecord(updateRecordTX, false, false, tx, null);
if (logger.isTraceEnabled()) {
logger.trace("appendUpdateRecordTransactional::txID=" + txID + ",id=" + id + ", userRecordType=" + recordType + ", record = " + record + ", usedFile = " + usedFile);
}
tx.addPositive(usedFile, id, updateRecordTX.getEncodeSize());
} catch (Exception e) {
logger.error("appendUpdateRecordTransactional:" + e.getMessage(), e);
setErrorCondition(null, tx, e);
} finally {
journalLock.readLock().unlock();
}
}
});
}
use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.
the class JournalImpl method appendAddRecordTransactional.
@Override
public void appendAddRecordTransactional(final long txID, final long id, final byte recordType, final Persister persister, final Object record) throws Exception {
checkJournalIsLoaded();
if (logger.isTraceEnabled()) {
logger.trace("scheduling appendAddRecordTransactional:txID=" + txID + ",id=" + id + ", userRecordType=" + recordType + ", record = " + record);
}
appendExecutor.execute(new Runnable() {
@Override
public void run() {
journalLock.readLock().lock();
final JournalTransaction tx = getTransactionInfo(txID);
try {
if (tx != null) {
tx.checkErrorCondition();
}
JournalInternalRecord addRecord = new JournalAddRecordTX(true, txID, id, recordType, persister, record);
JournalFile usedFile = appendRecord(addRecord, false, false, tx, null);
if (logger.isTraceEnabled()) {
logger.trace("appendAddRecordTransactional:txID=" + txID + ",id=" + id + ", userRecordType=" + recordType + ", record = " + record + ", usedFile = " + usedFile);
}
tx.addPositive(usedFile, id, addRecord.getEncodeSize());
} catch (Exception e) {
logger.error("appendAddRecordTransactional:" + e, e);
setErrorCondition(null, tx, e);
} finally {
journalLock.readLock().unlock();
}
}
});
}
use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.
the class FileWrapperJournal method appendAddRecordTransactional.
@Override
public void appendAddRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) throws Exception {
JournalInternalRecord addRecord = new JournalAddRecordTX(true, txID, id, recordType, persister, record);
writeRecord(addRecord, false, txID, false, null);
}
use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.
the class JournalCompactor method onReadAddRecordTX.
@Override
public void onReadAddRecordTX(final long transactionID, final RecordInfo info) throws Exception {
if (logger.isTraceEnabled()) {
logger.trace("Read Add Recprd TX " + transactionID + " info " + info);
}
if (pendingTransactions.get(transactionID) != null || lookupRecord(info.id)) {
JournalTransaction newTransaction = getNewJournalTransaction(transactionID);
JournalInternalRecord record = new JournalAddRecordTX(true, transactionID, info.id, info.getUserRecordType(), EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));
record.setCompactCount((short) (info.compactCount + 1));
checkSize(record.getEncodeSize(), info.compactCount);
newTransaction.addPositive(currentFile, info.id, record.getEncodeSize());
writeEncoder(record);
}
}
use of org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecordTX in project activemq-artemis by apache.
the class FileWrapperJournal method appendUpdateRecordTransactional.
@Override
public void appendUpdateRecordTransactional(long txID, long id, byte recordType, Persister persister, Object record) throws Exception {
JournalInternalRecord updateRecordTX = new JournalAddRecordTX(false, txID, id, recordType, persister, record);
writeRecord(updateRecordTX, false, txID, false, null);
}
Aggregations