@Override public void start() { if (logger.isDebugEnabled()) { logger.debug("Starting Unit Of Work"); } Assert.state(Phase.NOT_STARTED.equals(phase()), () -> "UnitOfWork is already started"); rolledBack = false; onRollback(u -> rolledBack = true); CurrentUnitOfWork.ifStarted(parent -> { // we're nesting. this.parentUnitOfWork = parent; root().onCleanup(r -> changePhase(Phase.CLEANUP, Phase.CLOSED)); }); changePhase(Phase.STARTED); CurrentUnitOfWork.set(this); }
@Override public void start() { if (logger.isDebugEnabled()) { logger.debug("Starting Unit Of Work"); } Assert.state(Phase.NOT_STARTED.equals(phase()), () -> "UnitOfWork is already started"); rolledBack = false; onRollback(u -> rolledBack = true); CurrentUnitOfWork.ifStarted(parent -> { // we're nesting. this.parentUnitOfWork = parent; root().onCleanup(r -> changePhase(Phase.CLEANUP, Phase.CLOSED)); }); changePhase(Phase.STARTED); CurrentUnitOfWork.set(this); }
@Override public void start() { if (logger.isDebugEnabled()) { logger.debug("Starting Unit Of Work"); } Assert.state(Phase.NOT_STARTED.equals(phase()), () -> "UnitOfWork is already started"); rolledBack = false; onRollback(u -> rolledBack = true); CurrentUnitOfWork.ifStarted(parent -> { // we're nesting. this.parentUnitOfWork = parent; root().onCleanup(r -> changePhase(Phase.CLEANUP, Phase.CLOSED)); }); changePhase(Phase.STARTED); CurrentUnitOfWork.set(this); }
/** * Return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. * * @return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. */ private boolean inStartedPhaseOfUnitOfWork() { return CurrentUnitOfWork.isStarted() && UnitOfWork.Phase.STARTED.equals(CurrentUnitOfWork.get().phase()); }
/** * Return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. * * @return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. */ private boolean inStartedPhaseOfUnitOfWork() { return CurrentUnitOfWork.isStarted() && UnitOfWork.Phase.STARTED.equals(CurrentUnitOfWork.get().phase()); }
/** * Return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. * * @return {@code true} if the {@link CurrentUnitOfWork#isStarted()} returns {@code true} and in if the phase is * {@link UnitOfWork.Phase#STARTED}, otherwise {@code false}. */ private boolean inStartedPhaseOfUnitOfWork() { return CurrentUnitOfWork.isStarted() && UnitOfWork.Phase.STARTED.equals(CurrentUnitOfWork.get().phase()); }