/** * Pause this Unit of Work by unregistering it with the {@link CurrentUnitOfWork}. This will detach it from the * current thread. */ public void pause() { CurrentUnitOfWork.clear(this); }
@Override public void commit() { if (logger.isDebugEnabled()) { logger.debug("Committing Unit Of Work"); } Assert.state(phase() == Phase.STARTED, () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { if (isRoot()) { commitAsRoot(); } else { commitAsNested(); } } 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); } }
/** * Pause this Unit of Work by unregistering it with the {@link CurrentUnitOfWork}. This will detach it from the * current thread. */ public void pause() { CurrentUnitOfWork.clear(this); }
/** * Pause this Unit of Work by unregistering it with the {@link CurrentUnitOfWork}. This will detach it from the * current thread. */ public void pause() { CurrentUnitOfWork.clear(this); }
@Override public void commit() { if (logger.isDebugEnabled()) { logger.debug("Committing Unit Of Work"); } Assert.state(phase() == Phase.STARTED, () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { if (isRoot()) { commitAsRoot(); } else { commitAsNested(); } } finally { CurrentUnitOfWork.clear(this); } }
@Override public void commit() { if (logger.isDebugEnabled()) { logger.debug("Committing Unit Of Work"); } Assert.state(phase() == Phase.STARTED, () -> String.format("The UnitOfWork is in an incompatible phase: %s", phase())); Assert.state(isCurrent(), () -> "The UnitOfWork is not the current Unit of Work"); try { if (isRoot()) { commitAsRoot(); } else { commitAsNested(); } } 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); } }
@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); } }