Exemplo n.º 1
0
  /**
   * Per the JDBC 3.0 spec, this rolls back the transaction for the specified Xid, not necessarily
   * for the transaction associated with this XAResource object.
   */
  public void rollback(Xid xid) throws XAException {

    JDBCXAResource resource = xaDataSource.getResource(xid);

    if (resource == null) {
      throw new XAException("The XADataSource has no such Xid in prepared state:  " + xid);
    }

    resource.rollbackThis();
  }
Exemplo n.º 2
0
  /**
   * Per the JDBC 3.0 spec, this commits the transaction for the specified Xid, not necessarily for
   * the transaction associated with this XAResource object.
   */
  public void commit(Xid xid, boolean onePhase) throws XAException {

    // Comment out following debug statement before public release:
    System.err.println("Performing a " + (onePhase ? "1-phase" : "2-phase") + " commit on " + xid);

    JDBCXAResource resource = xaDataSource.getResource(xid);

    if (resource == null) {
      throw new XAException("The XADataSource has no such Xid:  " + xid);
    }

    resource.commitThis(onePhase);
  }