/** * 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)); }
/** * 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)); }