code: private void commitOnePhase(Xid xid) throws XAException {
      try {
        // Check preconditions
        if (currentXid == null || !currentXid.equals(xid)) {
          // In fact, we don't know if xid is bogus, or if it just wasn't
          // associated with this
          // connection.
          // Assume it's our fault.
          throw new CloudSpannerXAException(CloudSpannerXAException.ONE_PHASE_SAME,
              Code.UNIMPLEMENTED, XAException.XAER_RMERR);
        }
        if (state != STATE_ENDED) {
          throw new CloudSpannerXAException(CloudSpannerXAException.COMMIT_BEFORE_END,
              Code.FAILED_PRECONDITION, XAException.XAER_PROTO);
        }
  
        // Preconditions are met. Commit
        state = STATE_IDLE;
        currentXid = null;
  
        conn.commit();
        conn.setAutoCommit(localAutoCommitMode);
      } catch (CloudSpannerSQLException ex) {
        throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_ONE_PHASE, ex,
            XAException.XAER_RMERR);
      } catch (SQLException ex) {
        throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_ONE_PHASE, ex, Code.UNKNOWN,
            XAException.XAER_RMERR);
      }
    }
docs: Preconditions: 1. xid must in ended state.
  
  Implementation deficiency preconditions: 1. this connection must have been used to run the
  transaction
  
  Postconditions: 1. Transaction is committed