private void commitAsNested() { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); delegateAfterCommitToParent(this); parentUnitOfWork.onRollback(u -> changePhase(Phase.ROLLBACK)); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } }
private void commitAsRoot() { try { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } if (phase() == Phase.COMMIT) { changePhase(Phase.AFTER_COMMIT); } } finally { changePhase(Phase.CLEANUP, Phase.CLOSED); } }
@Override public void rollback(Throwable cause) { if (logger.isDebugEnabled()) { logger.debug("Rolling back Unit Of Work.", cause); } Assert.state(isActive() && phase().isBefore(Phase.ROLLBACK), () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { setRollbackCause(cause); changePhase(Phase.ROLLBACK); if (isRoot()) { changePhase(Phase.CLEANUP, Phase.CLOSED); } } finally { CurrentUnitOfWork.clear(this); } }
private void commitAsNested() { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); delegateAfterCommitToParent(this); parentUnitOfWork.onRollback(u -> changePhase(Phase.ROLLBACK)); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } }
private void commitAsNested() { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); delegateAfterCommitToParent(this); parentUnitOfWork.onRollback(u -> changePhase(Phase.ROLLBACK)); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } }
private void commitAsRoot() { try { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } if (phase() == Phase.COMMIT) { changePhase(Phase.AFTER_COMMIT); } } finally { changePhase(Phase.CLEANUP, Phase.CLOSED); } }
private void commitAsRoot() { try { try { changePhase(Phase.PREPARE_COMMIT, Phase.COMMIT); } catch (Exception e) { setRollbackCause(e); changePhase(Phase.ROLLBACK); throw e; } if (phase() == Phase.COMMIT) { changePhase(Phase.AFTER_COMMIT); } } finally { changePhase(Phase.CLEANUP, Phase.CLOSED); } }
@Override public void rollback(Throwable cause) { if (logger.isDebugEnabled()) { logger.debug("Rolling back Unit Of Work.", cause); } Assert.state(isActive() && phase().isBefore(Phase.ROLLBACK), () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { setRollbackCause(cause); changePhase(Phase.ROLLBACK); if (isRoot()) { changePhase(Phase.CLEANUP, Phase.CLOSED); } } finally { CurrentUnitOfWork.clear(this); } }
@Override public void rollback(Throwable cause) { if (logger.isDebugEnabled()) { logger.debug("Rolling back Unit Of Work.", cause); } Assert.state(isActive() && phase().isBefore(Phase.ROLLBACK), () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { setRollbackCause(cause); changePhase(Phase.ROLLBACK); if (isRoot()) { changePhase(Phase.CLEANUP, Phase.CLOSED); } } finally { CurrentUnitOfWork.clear(this); } }