@Test public void testBatchModeDoesntLeakOutsideScope() { final Transaction[] txHolder = new Transaction[2]; UnitOfWork.begin(() -> newMockSession()); try { UnitOfWork.beginBatch(() -> newMockSession()); try { Transactional.operation.run(() -> txHolder[0] = UnitOfWork.currentTx()); Transactional.operation.run(() -> txHolder[1] = UnitOfWork.currentTx()); assertThat(txHolder[0], is(txHolder[1])); } finally { UnitOfWork.end(); } Transactional.operation.run(() -> txHolder[0] = UnitOfWork.currentTx()); Transactional.operation.run(() -> txHolder[1] = UnitOfWork.currentTx()); assertThat(txHolder[0], is(not(txHolder[1]))); } finally { UnitOfWork.end(); } }
public final void run(final VoidOperation<E> operation) throws E { transactional(new OperationPoint<>(operation)); }
Operations { public final void run(final VoidOperation<E> operation) throws E { transactional(new OperationPoint<>(operation)); } }
Operations { public final void run(final VoidOperation<E> operation) throws E { transactional(new OperationPoint<>(operation)); } protected  Operations(); protected  Operations(final Transactional spec,
                       @Nullable final Class<E> throwing,
                       @Nullable final TransactionalStore<?> store); }
Operations { public final void run(final VoidOperation<E> operation) throws E { transactional(new OperationPoint<>(operation)); } protected  Operations(); protected  Operations(final Transactional spec,
                       @Nullable final Class<E> throwing,
                       @Nullable final TransactionalStore<?> store); final B reason(final String reason); @SafeVarargs final B commitOn(final Class<? extends Exception>... exceptionTypes); @SafeVarargs final B retryOn(final Class<? extends Exception>... exceptionTypes); @SafeVarargs final B swallow(final Class<? extends Exception>... exceptionTypes); final B stereotype(final Class<? extends Annotation> annotationType); Operations<X, ?> throwing(final Class<X> exceptionType); final B withDb(final Supplier<? extends TransactionalSession<?>> db); final B withStore(final TransactionalStore<?> _store); final T call(final Operation<T, E> operation); final void run(final VoidOperation<E> operation); }
Operations { public final void run(final VoidOperation<E> operation) throws E { transactional(new OperationPoint<>(operation)); } protected  Operations(); protected  Operations(final Transactional spec,
                       @Nullable final Class<E> throwing,
                       @Nullable final TransactionalStore<?> store); final B reason(final String reason); @SafeVarargs final B commitOn(final Class<? extends Exception>... exceptionTypes); @SafeVarargs final B retryOn(final Class<? extends Exception>... exceptionTypes); @SafeVarargs final B swallow(final Class<? extends Exception>... exceptionTypes); final B stereotype(final Class<? extends Annotation> annotationType); Operations<X, ?> throwing(final Class<X> exceptionType); final B withDb(final Supplier<? extends TransactionalSession<?>> db); final B withStore(final TransactionalStore<?> _store); final T call(final Operation<T, E> operation); final void run(final VoidOperation<E> operation);  }