/**
   * 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);
  }