@Override
 public Object call() throws Exception {
   Transaction transaction = getTransaction();
   if (onePhase) {
     transaction.prepare();
   }
   transaction.commit();
   endpoint.removeTransactionContext(txnId);
   return null;
 }
Example #2
0
 @Override
 public int prepare(Xid xid) throws XAException {
   List<TransactionContext> contexts = xidContextMap.get(xid);
   if (contexts == null) {
     throw new XAException("There is no TransactionContexts for the given xid: " + xid);
   }
   for (TransactionContext context : contexts) {
     Transaction transaction = getTransaction(context);
     transaction.prepare();
   }
   return XA_OK;
 }
Example #3
0
  @Override
  public void commit(Xid xid, boolean onePhase) throws XAException {
    List<TransactionContext> contexts = xidContextMap.remove(xid);
    if (contexts == null && onePhase) {
      throw new XAException("There is no TransactionContexts for the given xid: " + xid);
    }
    if (contexts == null) {
      finalizeTransactionRemotely(xid, true);
      return;
    }

    for (TransactionContext context : contexts) {
      Transaction transaction = getTransaction(context);
      if (onePhase) {
        transaction.prepare();
      }
      transaction.commit();
    }
    clearRemoteTransactions(xid);
  }