@Test(expected = TransactionCommitFailedException.class) public void commitBlockingWithFail() throws Exception { doReturn(FluentFutures.immediateTrueFluentFuture()).when(cohort).canCommit(); doReturn(FluentFutures.immediateNullFluentFuture()).when(cohort).preCommit(); doReturn(FluentFutures.immediateNullFluentFuture()).when(cohort).abort(); doReturn(Futures.immediateFailedFuture(new InterruptedException())).when(cohort).commit(); task.call(); }
@Override public CommitInfo call() throws TransactionCommitFailedException { final long startTime = commitStatTracker != null ? System.nanoTime() : 0; Phase phase = Phase.CAN_COMMIT; try { LOG.debug("Transaction {}: canCommit Started", tx.getIdentifier()); canCommitBlocking(); phase = Phase.PRE_COMMIT; LOG.debug("Transaction {}: preCommit Started", tx.getIdentifier()); preCommitBlocking(); phase = Phase.DO_COMMIT; LOG.debug("Transaction {}: doCommit Started", tx.getIdentifier()); commitBlocking(); LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier()); return CommitInfo.empty(); } catch (final TransactionCommitFailedException e) { LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e); abortBlocking(e); throw e; } finally { if (commitStatTracker != null) { commitStatTracker.addDuration(System.nanoTime() - startTime); } } }
CommitCoordinationTask implements Callable<CommitInfo> { @Override public CommitInfo call() throws TransactionCommitFailedException { final long startTime = commitStatTracker != null ? System.nanoTime() : 0; Phase phase = Phase.CAN_COMMIT; try { LOG.debug("Transaction {}: canCommit Started", tx.getIdentifier()); canCommitBlocking(); phase = Phase.PRE_COMMIT; LOG.debug("Transaction {}: preCommit Started", tx.getIdentifier()); preCommitBlocking(); phase = Phase.DO_COMMIT; LOG.debug("Transaction {}: doCommit Started", tx.getIdentifier()); commitBlocking(); LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier()); return CommitInfo.empty(); } catch (final TransactionCommitFailedException e) { LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e); abortBlocking(e); throw e; } finally { if (commitStatTracker != null) { commitStatTracker.addDuration(System.nanoTime() - startTime); } } } }
CommitCoordinationTask implements Callable<CommitInfo> { @Override public CommitInfo call() throws TransactionCommitFailedException { final long startTime = commitStatTracker != null ? System.nanoTime() : 0; Phase phase = Phase.CAN_COMMIT; try { LOG.debug("Transaction {}: canCommit Started", tx.getIdentifier()); canCommitBlocking(); phase = Phase.PRE_COMMIT; LOG.debug("Transaction {}: preCommit Started", tx.getIdentifier()); preCommitBlocking(); phase = Phase.DO_COMMIT; LOG.debug("Transaction {}: doCommit Started", tx.getIdentifier()); commitBlocking(); LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier()); return CommitInfo.empty(); } catch (final TransactionCommitFailedException e) { LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e); abortBlocking(e); throw e; } finally { if (commitStatTracker != null) { commitStatTracker.addDuration(System.nanoTime() - startTime); } } } CommitCoordinationTask(final DOMDataTreeWriteTransaction transaction,
            final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
            final DurationStatisticsTracker commitStatTracker); }
CommitCoordinationTask implements Callable<CommitInfo> { @Override public CommitInfo call() throws TransactionCommitFailedException { final long startTime = commitStatTracker != null ? System.nanoTime() : 0; Phase phase = Phase.CAN_COMMIT; try { LOG.debug("Transaction {}: canCommit Started", tx.getIdentifier()); canCommitBlocking(); phase = Phase.PRE_COMMIT; LOG.debug("Transaction {}: preCommit Started", tx.getIdentifier()); preCommitBlocking(); phase = Phase.DO_COMMIT; LOG.debug("Transaction {}: doCommit Started", tx.getIdentifier()); commitBlocking(); LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier()); return CommitInfo.empty(); } catch (final TransactionCommitFailedException e) { LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e); abortBlocking(e); throw e; } finally { if (commitStatTracker != null) { commitStatTracker.addDuration(System.nanoTime() - startTime); } } } CommitCoordinationTask(final DOMDataTreeWriteTransaction transaction,
            final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
            final DurationStatisticsTracker commitStatTracker); @Override CommitInfo call(); }
CommitCoordinationTask implements Callable<CommitInfo> { @Override public CommitInfo call() throws TransactionCommitFailedException { final long startTime = commitStatTracker != null ? System.nanoTime() : 0; Phase phase = Phase.CAN_COMMIT; try { LOG.debug("Transaction {}: canCommit Started", tx.getIdentifier()); canCommitBlocking(); phase = Phase.PRE_COMMIT; LOG.debug("Transaction {}: preCommit Started", tx.getIdentifier()); preCommitBlocking(); phase = Phase.DO_COMMIT; LOG.debug("Transaction {}: doCommit Started", tx.getIdentifier()); commitBlocking(); LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier()); return CommitInfo.empty(); } catch (final TransactionCommitFailedException e) { LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e); abortBlocking(e); throw e; } finally { if (commitStatTracker != null) { commitStatTracker.addDuration(System.nanoTime() - startTime); } } } CommitCoordinationTask(final DOMDataTreeWriteTransaction transaction,
            final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
            final DurationStatisticsTracker commitStatTracker); @Override CommitInfo call();  }