/** * 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; } }
@NotNull LocalTransaction beginTransaction(final int timeout, final boolean failOnSuspend, CreationListener.CreatedBy createdBy) throws SystemException, SecurityException { Assert.checkMinimumParameter("timeout", 0, timeout); if (failOnSuspend && requestsSuspended) { throw Log.log.suspendedCannotCreateNew(); } final Transaction newTransaction = provider.createNewTransaction(timeout); //noinspection ConstantConditions if (newTransaction == null) { throw Log.log.providerCreatedNullTransaction(); } return getOrAttach(newTransaction, createdBy); }
/** * Attempt to import a transaction, which subsequently may be controlled by its XID or by the returned handle. * * @param xid the XID of the transaction to import (must not be {@code null}) * @param timeout the transaction timeout to use, if new * @param doNotImport {@code true} to indicate that a non-existing transaction should not be imported, {@code false} otherwise * @return the transaction import result, or {@code null} if (and only if) {@code doNotImport} is {@code true} and the transaction didn't exist locally * @throws XAException if a problem occurred while importing the transaction */ public ImportResult<LocalTransaction> findOrImportTransaction(Xid xid, int timeout, boolean doNotImport) throws XAException { Assert.checkNotNullParam("xid", xid); Assert.checkMinimumParameter("timeout", 0, timeout); XAImporter xaImporter = provider.getXAImporter(); final boolean requestsSuspended = this.requestsSuspended; final ImportResult<?> result = xaImporter.findOrImportTransaction(xid, timeout, doNotImport || requestsSuspended); if (result == null) { if (! doNotImport) { if (requestsSuspended) { throw Log.log.suspendedCannotImportXa(XAException.XAER_RMERR); } throw Log.log.providerCreatedNullTransaction(); } return null; } return result.withTransaction(getOrAttach(result.getTransaction(), result.isNew() ? CreationListener.CreatedBy.IMPORT : CreationListener.CreatedBy.MERGE)); }
/** * 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; } }
/** * 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; } }
@NotNull LocalTransaction beginTransaction(final int timeout, final boolean failOnSuspend, CreationListener.CreatedBy createdBy) throws SystemException, SecurityException { Assert.checkMinimumParameter("timeout", 0, timeout); if (failOnSuspend && requestsSuspended) { throw Log.log.suspendedCannotCreateNew(); } final Transaction newTransaction = provider.createNewTransaction(timeout); //noinspection ConstantConditions if (newTransaction == null) { throw Log.log.providerCreatedNullTransaction(); } return getOrAttach(newTransaction, createdBy); }
@NotNull LocalTransaction beginTransaction(final int timeout, final boolean failOnSuspend, CreationListener.CreatedBy createdBy) throws SystemException, SecurityException { Assert.checkMinimumParameter("timeout", 0, timeout); if (failOnSuspend && requestsSuspended) { throw Log.log.suspendedCannotCreateNew(); } final Transaction newTransaction = provider.createNewTransaction(timeout); //noinspection ConstantConditions if (newTransaction == null) { throw Log.log.providerCreatedNullTransaction(); } return getOrAttach(newTransaction, createdBy); }
/** * Attempt to import a transaction, which subsequently may be controlled by its XID or by the returned handle. * * @param xid the XID of the transaction to import (must not be {@code null}) * @param timeout the transaction timeout to use, if new * @param doNotImport {@code true} to indicate that a non-existing transaction should not be imported, {@code false} otherwise * @return the transaction import result, or {@code null} if (and only if) {@code doNotImport} is {@code true} and the transaction didn't exist locally * @throws XAException if a problem occurred while importing the transaction */ public ImportResult<LocalTransaction> findOrImportTransaction(Xid xid, int timeout, boolean doNotImport) throws XAException { Assert.checkNotNullParam("xid", xid); Assert.checkMinimumParameter("timeout", 0, timeout); XAImporter xaImporter = provider.getXAImporter(); final boolean requestsSuspended = this.requestsSuspended; final ImportResult<?> result = xaImporter.findOrImportTransaction(xid, timeout, doNotImport || requestsSuspended); if (result == null) { if (! doNotImport) { if (requestsSuspended) { throw Log.log.suspendedCannotImportXa(XAException.XAER_RMERR); } throw Log.log.providerCreatedNullTransaction(); } return null; } return result.withTransaction(getOrAttach(result.getTransaction(), result.isNew() ? CreationListener.CreatedBy.IMPORT : CreationListener.CreatedBy.MERGE)); }
/** * Attempt to import a transaction, which subsequently may be controlled by its XID or by the returned handle. * * @param xid the XID of the transaction to import (must not be {@code null}) * @param timeout the transaction timeout to use, if new * @param doNotImport {@code true} to indicate that a non-existing transaction should not be imported, {@code false} otherwise * @return the transaction import result, or {@code null} if (and only if) {@code doNotImport} is {@code true} and the transaction didn't exist locally * @throws XAException if a problem occurred while importing the transaction */ public ImportResult<LocalTransaction> findOrImportTransaction(Xid xid, int timeout, boolean doNotImport) throws XAException { Assert.checkNotNullParam("xid", xid); Assert.checkMinimumParameter("timeout", 0, timeout); XAImporter xaImporter = provider.getXAImporter(); final boolean requestsSuspended = this.requestsSuspended; final ImportResult<?> result = xaImporter.findOrImportTransaction(xid, timeout, doNotImport || requestsSuspended); if (result == null) { if (! doNotImport) { if (requestsSuspended) { throw Log.log.suspendedCannotImportXa(XAException.XAER_RMERR); } throw Log.log.providerCreatedNullTransaction(); } return null; } return result.withTransaction(getOrAttach(result.getTransaction(), result.isNew() ? CreationListener.CreatedBy.IMPORT : CreationListener.CreatedBy.MERGE)); }