/** * Outflow the given local transaction to the given location. The returned handle * must be used to confirm or forget the enlistment attempt either immediately or at some point in the future; * failure to do so may cause the transaction to be rolled back with an error. * * @param location the location to outflow to (must not be {@code null}) * @param transaction the transaction (must not be {@code null}) * @return the enlistment handle (not {@code null}) * @throws SystemException if the transaction manager fails for some reason * @throws RollbackException if the transaction has been rolled back in the meantime * @throws IllegalStateException if no transaction is active * @throws UnsupportedOperationException if the provider for the location does not support outflow */ public XAOutflowHandle outflowTransaction(final URI location, final LocalTransaction transaction) throws SystemException, IllegalStateException, UnsupportedOperationException, RollbackException { Assert.checkNotNullParam("location", location); Assert.checkNotNullParam("transaction", transaction); XAOutflowedResources outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { synchronized (transaction.getOutflowLock()) { outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { transaction.putResource(outflowKey, outflowedResources = new XAOutflowedResources(transaction)); } } } SubordinateXAResource resource = outflowedResources.getOrEnlist(location, transaction.getParentName()); return resource.addHandle(resource.getXid()); }
/** * Outflow the given local transaction to the given location. The returned handle * must be used to confirm or forget the enlistment attempt either immediately or at some point in the future; * failure to do so may cause the transaction to be rolled back with an error. * * @param location the location to outflow to (must not be {@code null}) * @param transaction the transaction (must not be {@code null}) * @return the enlistment handle (not {@code null}) * @throws SystemException if the transaction manager fails for some reason * @throws RollbackException if the transaction has been rolled back in the meantime * @throws IllegalStateException if no transaction is active * @throws UnsupportedOperationException if the provider for the location does not support outflow */ public XAOutflowHandle outflowTransaction(final URI location, final LocalTransaction transaction) throws SystemException, IllegalStateException, UnsupportedOperationException, RollbackException { Assert.checkNotNullParam("location", location); Assert.checkNotNullParam("transaction", transaction); XAOutflowedResources outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { synchronized (transaction.getOutflowLock()) { outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { transaction.putResource(outflowKey, outflowedResources = new XAOutflowedResources(transaction)); } } } SubordinateXAResource resource = outflowedResources.getOrEnlist(location, transaction.getParentName()); return resource.addHandle(resource.getXid()); }
/** * Outflow the given local transaction to the given location. The returned handle * must be used to confirm or forget the enlistment attempt either immediately or at some point in the future; * failure to do so may cause the transaction to be rolled back with an error. * * @param location the location to outflow to (must not be {@code null}) * @param transaction the transaction (must not be {@code null}) * @return the enlistment handle (not {@code null}) * @throws SystemException if the transaction manager fails for some reason * @throws RollbackException if the transaction has been rolled back in the meantime * @throws IllegalStateException if no transaction is active * @throws UnsupportedOperationException if the provider for the location does not support outflow */ public XAOutflowHandle outflowTransaction(final URI location, final LocalTransaction transaction) throws SystemException, IllegalStateException, UnsupportedOperationException, RollbackException { Assert.checkNotNullParam("location", location); Assert.checkNotNullParam("transaction", transaction); XAOutflowedResources outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { synchronized (transaction.getOutflowLock()) { outflowedResources = getOutflowedResources(transaction); if (outflowedResources == null) { transaction.putResource(outflowKey, outflowedResources = new XAOutflowedResources(transaction)); } } } SubordinateXAResource resource = outflowedResources.getOrEnlist(location, transaction.getParentName()); return resource.addHandle(resource.getXid()); }