@Override public void commitBindings(final long txID) throws Exception { bindingsJournal.appendCommitRecord(txID, true); }
@Override public void appendCommitRecord(final long txID, final boolean sync, final IOCompletion callback) throws Exception { if (log.isTraceEnabled()) { log.trace("AppendCommit " + txID); } replicationManager.appendCommitRecord(journalID, txID, sync, true); localJournal.appendCommitRecord(txID, sync, callback); }
@Override public void appendCommitRecord(long txID, boolean sync, IOCompletion callback, boolean lineUpContext) throws Exception { if (log.isTraceEnabled()) { log.trace("AppendCommit " + txID); } replicationManager.appendCommitRecord(journalID, txID, sync, lineUpContext); localJournal.appendCommitRecord(txID, sync, callback, lineUpContext); }
/** * @param txID * @param sync * @throws Exception * @see org.apache.activemq.artemis.core.journal.Journal#appendCommitRecord(long, boolean) */ @Override public void appendCommitRecord(final long txID, final boolean sync) throws Exception { if (log.isTraceEnabled()) { log.trace("AppendCommit txID=" + txID); } replicationManager.appendCommitRecord(journalID, txID, sync, true); localJournal.appendCommitRecord(txID, sync); }
@Override public void commit(final long txID, final boolean lineUpContext) throws Exception { readLock(); try { messageJournal.appendCommitRecord(txID, syncTransactional, getContext(syncTransactional), lineUpContext); if (!lineUpContext && !syncTransactional) { if (logger.isTraceEnabled()) { logger.trace("calling getContext(true).done() for txID=" + txID + ",lineupContext=" + lineUpContext + " syncTransactional=" + syncTransactional + "... forcing call on getContext(true).done"); } /** * If {@code lineUpContext == false}, it means that we have previously lined up a * context somewhere else (specifically see @{link TransactionImpl#asyncAppendCommit}), * hence we need to mark it as done even if {@code syncTransactional = false} as in this * case {@code getContext(syncTransactional=false)} would pass a dummy context to the * {@code messageJournal.appendCommitRecord(...)} call above. */ getContext(true).done(); } } finally { readUnLock(); } }
@Override public void deleteBindings(PersistedType type, String name, String address) throws Exception { Pair<PersistedType, String> key = new Pair<>(type, name); long tx = idGenerator.generateID(); PersistedBindings currentBindings = mapBindings.get(key); if (currentBindings == null) { return; } else { jmsJournal.appendDeleteRecordTransactional(tx, currentBindings.getId()); } currentBindings.deleteBinding(address); if (currentBindings.getBindings().size() == 0) { mapBindings.remove(key); } else { long newId = idGenerator.generateID(); currentBindings.setId(newId); jmsJournal.appendAddRecordTransactional(tx, newId, BINDING_RECORD, currentBindings); } jmsJournal.appendCommitRecord(tx, true); }
/** * @param packet */ private void handleCommitRollback(final ReplicationCommitMessage packet) throws Exception { Journal journalToUse = getJournal(packet.getJournalID()); if (packet.isRollback()) { journalToUse.appendRollbackRecord(packet.getTxId(), noSync); } else { journalToUse.appendCommitRecord(packet.getTxId(), noSync); } }
@Override public void addBindings(PersistedType type, String name, String... address) throws Exception { Pair<PersistedType, String> key = new Pair<>(type, name); long tx = idGenerator.generateID(); PersistedBindings currentBindings = mapBindings.get(key); if (currentBindings != null) { jmsJournal.appendDeleteRecordTransactional(tx, currentBindings.getId()); } else { currentBindings = new PersistedBindings(type, name); } mapBindings.put(key, currentBindings); for (String adItem : address) { currentBindings.addBinding(adItem); } long newId = idGenerator.generateID(); currentBindings.setId(newId); jmsJournal.appendAddRecordTransactional(tx, newId, BINDING_RECORD, currentBindings); jmsJournal.appendCommitRecord(tx, true); }
replicatedJournal.appendAddRecordTransactional(2, 2, (byte) 1, new FakeData()); replicatedJournal.appendUpdateRecordTransactional(2, 2, (byte) 2, new FakeData()); replicatedJournal.appendCommitRecord(2, false);