@Override public void run() { journalLock.readLock().lock(); // cannot remove otherwise compact may get lost final JournalTransaction tx = transactions.remove(txID); try { if (tx == null) { throw new IllegalStateException("Cannot find tx with id " + txID); } JournalInternalRecord commitRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.COMMIT, txID, null); JournalFile usedFile = appendRecord(commitRecord, true, sync, tx, callback); if (logger.isTraceEnabled()) { logger.trace("appendCommitRecord::txID=" + txID + ", usedFile = " + usedFile); } tx.commit(usedFile); } catch (ActiveMQShutdownException e) { result.fail(e); logger.error("appendCommitRecord:" + e, e); } catch (Throwable e) { result.fail(e); logger.error("appendCommitRecord:" + e, e); setErrorCondition(callback, tx, e); } finally { journalLock.readLock().unlock(); result.set(tx); } } });
@Override public void run() { journalLock.readLock().lock(); // cannot remove otherwise compact may get lost final JournalTransaction tx = transactions.remove(txID); try { if (tx == null) { throw new IllegalStateException("Cannot find tx with id " + txID); } JournalInternalRecord commitRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.COMMIT, txID, null); JournalFile usedFile = appendRecord(commitRecord, true, sync, tx, callback); if (logger.isTraceEnabled()) { logger.trace("appendCommitRecord::txID=" + txID + ", usedFile = " + usedFile); } tx.commit(usedFile); } catch (ActiveMQShutdownException e) { result.fail(e); logger.error("appendCommitRecord:" + e, e); } catch (Throwable e) { result.fail(e); logger.error("appendCommitRecord:" + e, e); setErrorCondition(callback, tx, e); } finally { journalLock.readLock().unlock(); result.set(tx); } } });
@Override void execute() throws Exception { JournalTransaction newTransaction = newTransactions.get(liveTransaction.getId()); if (newTransaction != null) { liveTransaction.merge(newTransaction); liveTransaction.commit(commitFile); } newTransactions.remove(liveTransaction.getId()); }
@Override void execute() throws Exception { JournalTransaction newTransaction = newTransactions.get(liveTransaction.getId()); if (newTransaction != null) { liveTransaction.merge(newTransaction); liveTransaction.commit(commitFile); } newTransactions.remove(liveTransaction.getId()); }
@Override public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception { if (logger.isTraceEnabled()) { logger.trace("onReadCommitRecord " + transactionID); } if (pendingTransactions.get(transactionID) != null) { // Sanity check, this should never happen ActiveMQJournalLogger.LOGGER.inconsistencyDuringCompacting(transactionID); } else { JournalTransaction newTransaction = newTransactions.remove(transactionID); if (newTransaction != null) { JournalInternalRecord commitRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.COMMIT, transactionID, null); checkSize(commitRecord.getEncodeSize()); writeEncoder(commitRecord, newTransaction.getCounter(currentFile)); newTransaction.commit(currentFile); } } }
@Override public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception { if (logger.isTraceEnabled()) { logger.trace("onReadCommitRecord " + transactionID); } if (pendingTransactions.get(transactionID) != null) { // Sanity check, this should never happen ActiveMQJournalLogger.LOGGER.inconsistencyDuringCompacting(transactionID); } else { JournalTransaction newTransaction = newTransactions.remove(transactionID); if (newTransaction != null) { JournalInternalRecord commitRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.COMMIT, transactionID, null); checkSize(commitRecord.getEncodeSize()); writeEncoder(commitRecord, newTransaction.getCounter(currentFile)); newTransaction.commit(currentFile); } } }
journalTransaction.commit(file); } else { ActiveMQJournalLogger.LOGGER.txMissingElements(transactionID);
journalTransaction.commit(file); } else { ActiveMQJournalLogger.LOGGER.txMissingElements(transactionID);