void unimportBacking() { final ContextTransactionManager.State state = ContextTransactionManager.INSTANCE.getStateRef().get(); if (state.transaction.equals(this)) { state.transaction = null; } }
public Object getTransactionKey() { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; return transaction == null ? null : transaction.getKey(); }
public Object getResource(final Object key) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getResource(key); }
public void putResource(final Object key, final Object value) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } transaction.putResource(key, value); } }
public void registerInterposedSynchronization(final Synchronization sync) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } transaction.registerInterposedSynchronization(sync); }
public <T, U, E extends Exception> void performConsumer(ExceptionBiConsumer<T, U, E> consumer, T param1, U param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }
public boolean getRollbackOnly() throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getRollbackOnly(); }
public <T, U, R, E extends Exception> R performFunction(ExceptionBiFunction<T, U, R, E> function, T param1, U param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { return function.apply(param1, param2); } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { return function.apply(param1, param2); } } }
public <T, E extends Exception> void performConsumer(ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }
public <T, U, E extends Exception> int performToIntFunction(ExceptionToIntBiFunction<T, U, E> function, T param1, U param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { return function.apply(param1, param2); } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { return function.apply(param1, param2); } } }
/** * Attempt to import a provider's current transaction as a local transaction. * * @return {@code true} if the transaction was associated, {@code false} if the provider had no current transaction * @throws SystemException if an error occurred acquiring the current transaction from the provider * @throws IllegalStateException if the thread is associated with a transaction that isn't equal to the provider's transaction */ public boolean importProviderTransaction() throws SystemException { final ContextTransactionManager.State state = ContextTransactionManager.INSTANCE.getStateRef().get(); final Transaction transaction = provider.getTransactionManager().getTransaction(); if (transaction == null) { return false; } final LocalTransaction localTransaction = getOrAttach(transaction, CreationListener.CreatedBy.MERGE); if (state.transaction == null) { state.transaction = localTransaction; } else { localTransaction.verifyAssociation(); } return true; }
boolean importBacking() throws SystemException { final ContextTransactionManager.State state = ContextTransactionManager.INSTANCE.getStateRef().get(); final Transaction transaction = owner.getProvider().getTransactionManager().getTransaction(); if (transaction == null) { return false; } final LocalTransaction localTransaction = owner.getOrAttach(transaction, CreationListener.CreatedBy.MERGE); if (state.transaction == null) { state.transaction = localTransaction; return true; } else { localTransaction.verifyAssociation(); return false; } }
void unimportBacking() { final ContextTransactionManager.State state = ContextTransactionManager.INSTANCE.getStateRef().get(); if (state.transaction.equals(this)) { state.transaction = null; } }
public void putResource(final Object key, final Object value) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } transaction.putResource(key, value); } }
public boolean getRollbackOnly() throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getRollbackOnly(); }
public Object getResource(final Object key) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } return transaction.getResource(key); }
public void registerInterposedSynchronization(final Synchronization sync) throws IllegalStateException { final AbstractTransaction transaction = ContextTransactionManager.getInstance().getStateRef().get().transaction; if (transaction == null) { throw Log.log.noTransaction(); } transaction.registerInterposedSynchronization(sync); }
public <T, U, R, E extends Exception> R performFunction(ExceptionBiFunction<T, U, R, E> function, T param1, U param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { return function.apply(param1, param2); } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { return function.apply(param1, param2); } } }
public <T, U, E extends Exception> int performToIntFunction(ExceptionToIntBiFunction<T, U, E> function, T param1, U param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { return function.apply(param1, param2); } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { return function.apply(param1, param2); } } }
public <T, E extends Exception> void performConsumer(ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException { final ContextTransactionManager tm = ContextTransactionManager.INSTANCE; if (Objects.equals(tm.getStateRef().get().transaction, this)) { consumer.accept(param1, param2); return; } try (SysExTry ignored = whileSuspended()) { try (SysExTry ignored2 = whileResumed(this)) { consumer.accept(param1, param2); } } }