@Override public void add(TransactionLogRecord record) { if (state != Transaction.State.ACTIVE) { throw new TransactionNotActiveException("Transaction is not active!"); } checkThread(); transactionLog.add(record); }
@Override public void add(TransactionLogRecord record) { if (state != Transaction.State.ACTIVE) { throw new TransactionNotActiveException("Transaction is not active!"); } checkThread(); transactionLog.add(record); }
checkThread(); checkTimeout(); try {
checkThread(); checkTimeout(); try {
@Override public void rollback() throws IllegalStateException { try { if (state == NO_TXN || state == ROLLED_BACK) { throw new IllegalStateException("Transaction is not active"); } checkThread(); state = ROLLING_BACK; try { //TODO: Do we need both a purge and rollback? rollbackBackupLogs(); List<Future> futures = transactionLog.rollback(nodeEngine); waitWithDeadline(futures, Long.MAX_VALUE, MILLISECONDS, rollbackExceptionHandler); purgeBackupLogs(); } catch (Throwable e) { throw rethrow(e); } finally { state = ROLLED_BACK; transactionManagerService.rollbackCount.inc(); } } finally { setThreadFlag(null); } }
@Override public void rollback() throws IllegalStateException { try { if (state == NO_TXN || state == ROLLED_BACK) { throw new IllegalStateException("Transaction is not active"); } checkThread(); state = ROLLING_BACK; try { //TODO: Do we need both a purge and rollback? rollbackBackupLogs(); List<Future> futures = transactionLog.rollback(nodeEngine); waitWithDeadline(futures, Long.MAX_VALUE, MILLISECONDS, rollbackExceptionHandler); purgeBackupLogs(); } catch (Throwable e) { throw rethrow(e); } finally { state = ROLLED_BACK; transactionManagerService.rollbackCount.inc(); } } finally { setThreadFlag(null); } }
@Override public void prepare() throws TransactionException { if (state != ACTIVE) { throw new TransactionNotActiveException("Transaction is not active"); } checkThread(); checkTimeout(); try { createBackupLogs(); state = PREPARING; List<Future> futures = transactionLog.prepare(nodeEngine); waitUntilAllRespondedWithDeadline(futures, timeoutMillis, MILLISECONDS, RETHROW_TRANSACTION_EXCEPTION); state = PREPARED; replicateTxnLog(); } catch (Throwable e) { throw rethrow(e, TransactionException.class); } }
@Override public void prepare() throws TransactionException { if (state != ACTIVE) { throw new TransactionNotActiveException("Transaction is not active"); } checkThread(); checkTimeout(); try { createBackupLogs(); state = PREPARING; List<Future> futures = transactionLog.prepare(nodeEngine); waitUntilAllRespondedWithDeadline(futures, timeoutMillis, MILLISECONDS, RETHROW_TRANSACTION_EXCEPTION); state = PREPARED; replicateTxnLog(); } catch (Throwable e) { throw rethrow(e, TransactionException.class); } }