public int prepare(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; return executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_PREPARE_REQUEST, true, false, false); }
public void rollback(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_ROLLBACK_REQUEST, false, false, false); }
public void beforeCompletion(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_BEFORE_COMPLETION_REQUEST, false, false, false); }
public void forget(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_FORGET_REQUEST, false, false, false); }
public void commit(final Xid xid, final boolean onePhase, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_COMMIT_REQUEST, false, true, onePhase); }
/** * Create a transaction ID object for the given encoded representation. * * @param encoded the encoded representation * @return the transaction ID object */ public static TransactionID createTransactionID(byte[] encoded) { final int length = encoded.length; if (length > 0) switch (encoded[0]) { case 1: { // local transaction. return new UserTransactionID(encoded.clone()); } case 2: { // XID. return new XidTransactionID(encoded.clone()); } default: { } } throw new IllegalArgumentException("Unrecognized Transaction ID format"); }
private TransactionID calculateTransactionId(final Transaction transaction) throws RollbackException, SystemException, InvalidTransactionException { final URI location = channel.getConnection().getPeerURI(); Assert.assertNotNull(transaction); if (transaction instanceof RemoteTransaction) { final RemoteTransaction remoteTransaction = (RemoteTransaction) transaction; remoteTransaction.setLocation(location); final SimpleIdResolver ir = remoteTransaction.getProviderInterface(SimpleIdResolver.class); if (ir == null) throw Logs.TXN.cannotEnlistTx(); return new UserTransactionID(channel.getConnection().getRemoteEndpointName(), ir.getTransactionId(channel.getConnection())); } else if (transaction instanceof LocalTransaction) { final LocalTransaction localTransaction = (LocalTransaction) transaction; final XAOutflowHandle outflowHandle = transactionContext.outflowTransaction(location, localTransaction); // always verify V1/2 outflows outflowHandle.verifyEnlistment(); return new XidTransactionID(outflowHandle.getXid()); } else { throw Logs.TXN.cannotEnlistTx(); } }
void handleTxnRecoverRequest(final int invId, final MessageInputStream message) throws IOException { final String parentName = message.readUTF(); final int flags = message.readInt(); final Xid[] xids; try { xids = transactionServer.getTransactionService().getTransactionContext().getRecoveryInterface().recover(flags, parentName); } catch (XAException e) { writeFailedResponse(invId, e); return; } try (MessageOutputStream os = messageTracker.openMessageUninterruptibly()) { os.writeByte(Protocol.TXN_RECOVERY_RESPONSE); os.writeShort(invId); PackedInteger.writePackedInteger(os, xids.length); final Marshaller marshaller = marshallerFactory.createMarshaller(configuration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(os))); for (Xid xid : xids) { marshaller.writeObject(new XidTransactionID(xid)); } marshaller.finish(); } catch (IOException e) { // nothing to do at this point; the client doesn't want the response Logs.REMOTING.trace("EJB transaction response write failed", e); } }
public int prepare(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; return executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_PREPARE_REQUEST, true, false, false); }
public void rollback(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_ROLLBACK_REQUEST, false, false, false); }
public void forget(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_FORGET_REQUEST, false, false, false); }
public void commit(final Xid xid, final boolean onePhase, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_COMMIT_REQUEST, false, true, onePhase); }
public void rollback(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_ROLLBACK_REQUEST, false, false, false); }
public void beforeCompletion(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_BEFORE_COMPLETION_REQUEST, false, false, false); }
public int prepare(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; return executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_PREPARE_REQUEST, true, false, false); }
public void forget(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_FORGET_REQUEST, false, false, false); }
public void commit(final Xid xid, final boolean onePhase, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_COMMIT_REQUEST, false, true, onePhase); }
public void beforeCompletion(final Xid xid, final ConnectionPeerIdentity peerIdentity) throws XAException { assert peerIdentity.getId() == 0; executeSimpleInvocation(new XidTransactionID(xid), Protocol.TXN_BEFORE_COMPLETION_REQUEST, false, false, false); }
/** * Create a transaction ID object for the given encoded representation. * * @param encoded the encoded representation * @return the transaction ID object */ public static TransactionID createTransactionID(byte[] encoded) { final int length = encoded.length; if (length > 0) switch (encoded[0]) { case 1: { // local transaction. return new UserTransactionID(encoded.clone()); } case 2: { // XID. return new XidTransactionID(encoded.clone()); } default: { } } throw new IllegalArgumentException("Unrecognized Transaction ID format"); }
private TransactionID calculateTransactionId(final Transaction transaction) throws RollbackException, SystemException, InvalidTransactionException { final URI location = channel.getConnection().getPeerURI(); Assert.assertNotNull(transaction); if (transaction instanceof RemoteTransaction) { final RemoteTransaction remoteTransaction = (RemoteTransaction) transaction; remoteTransaction.setLocation(location); final SimpleIdResolver ir = remoteTransaction.getProviderInterface(SimpleIdResolver.class); if (ir == null) throw Logs.TXN.cannotEnlistTx(); return new UserTransactionID(channel.getConnection().getRemoteEndpointName(), ir.getTransactionId(channel.getConnection())); } else if (transaction instanceof LocalTransaction) { final LocalTransaction localTransaction = (LocalTransaction) transaction; final XAOutflowHandle outflowHandle = transactionContext.outflowTransaction(location, localTransaction); // always verify V1/2 outflows outflowHandle.verifyEnlistment(); return new XidTransactionID(outflowHandle.getXid()); } else { throw Logs.TXN.cannotEnlistTx(); } }