From e64ecf5523f7f5a0ce924cc4bf2666ece425f135 Mon Sep 17 00:00:00 2001 From: jbertram Date: Thu, 25 Feb 2016 13:31:19 -0600 Subject: [PATCH] ARTEMIS-422 support appendRollbackRecord --- .../core/journal/impl/FileWrapperJournal.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java index cf09fd7902..2be920040c 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java @@ -41,6 +41,7 @@ import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalCompleteR import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecord; import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX; import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord; +import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalRollbackRecordTX; /** * Journal used at a replicating backup server during the synchronization of data with the 'live' @@ -208,13 +209,18 @@ public final class FileWrapperJournal extends JournalBase { return FileWrapperJournal.class.getName() + "(currentFile=[" + currentFile + "], hash=" + super.toString() + ")"; } - // UNSUPPORTED STUFF - @Override public void appendRollbackRecord(long txID, boolean sync, IOCompletion callback) throws Exception { - throw new ActiveMQUnsupportedPacketException(); + JournalInternalRecord rollbackRecord = new JournalRollbackRecordTX(txID); + AtomicInteger value = transactions.remove(Long.valueOf(txID)); + if (value != null) { + rollbackRecord.setNumberOfRecords(value.get()); + } + writeRecord(rollbackRecord, sync, callback); } + // UNSUPPORTED STUFF + @Override public JournalLoadInformation load(LoaderCallback reloadManager) throws Exception { throw new ActiveMQUnsupportedPacketException();