/** * Reloads an in doubt resource, recreating a previously lost remote XA resource object. This method * must be invoked to recreate in doubt resources after a server shutdown or crash. * * @param uri the URI where the outflowed resource is located * @param nodeName the node name of the resource * @return a newly-created resource representing a previously lost XA resource that is in doubt */ protected XAResource reloadInDoubtResource(URI uri, String nodeName) { return new SubordinateXAResource(uri, nodeName, FL_COMMITTED | FL_CONFIRMED, this); } }
public void beforeCompletion() { try { if (finalXaResource.commitToEnlistment()) { finalXaResource.beforeCompletion(finalXaResource.getXid()); } } catch (XAException e) { throw new SynchronizationException(e); } }
private SubordinateTransactionControl lookup(final Xid xid) throws XAException { return getProvider().getPeerHandleForXa(location, null, null).lookupXid(xid); }
public void forget(final Xid xid) throws XAException { if (commitToEnlistment()) lookup(xid).forget(); }
/** * 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()); }
public void start(final Xid xid, final int flags) throws XAException { if (flags == TMJOIN) { // should be impossible throw Assert.unreachableCode(); } // ensure that the timeout is registered startTime = System.nanoTime(); capturedTimeout = timeout; lookup(xid); this.xid = xid; }
public int getRemainingTime() { return SubordinateXAResource.this.getRemainingTime(); }
public Xid[] recover(final int flag) throws XAException { return recover(flag, parentName); }
public void beforeCompletion(final Xid xid) throws XAException { if (commitToEnlistment()) lookup(xid).beforeCompletion(); }
/** * 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()); }
public void end(final Xid xid, final int flags) throws XAException { if (flags == TMSUCCESS || flags == TMFAIL) { lookup(xid).end(flags); } }
public int getRemainingTime() { return SubordinateXAResource.this.getRemainingTime(); }
public Xid[] recover(final int flag) throws XAException { return recover(flag, parentName); }
public void commit(final Xid xid, final boolean onePhase) throws XAException { try { if (commitToEnlistment()) lookup(xid).commit(onePhase); } catch (XAException | RuntimeException exception) { if (onePhase && resourceRegistry != null) resourceRegistry.resourceInDoubt(this); throw exception; } if (onePhase && resourceRegistry != null) resourceRegistry.removeResource(this); }
public void beforeCompletion() { try { if (finalXaResource.commitToEnlistment()) { finalXaResource.beforeCompletion(finalXaResource.getXid()); } } catch (XAException e) { throw new SynchronizationException(e); } }
/** * 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()); }
Object readResolve() { return new SubordinateXAResource(location, FL_COMMITTED | FL_CONFIRMED, parentName); } }
public void start(final Xid xid, final int flags) throws XAException { if (flags == TMJOIN) { // should be impossible throw Assert.unreachableCode(); } // ensure that the timeout is registered startTime = System.nanoTime(); capturedTimeout = timeout; lookup(xid); this.xid = xid; }
public Xid[] recover(final int flag, final String parentName) throws XAException { return getProvider().getPeerHandleForXa(location, null, null).recover(flag, parentName); }
public int getRemainingTime() { return SubordinateXAResource.this.getRemainingTime(); }