code: public void end(Xid xid, int flags) throws XAException {
      if (flags != TMSUCCESS && flags != TMSUSPEND && flags != TMFAIL) {
        throw new XAException(XAException.XAER_INVAL);
      }
  
      execute("XA END " + xidToString(xid) + " " + flagsToString(flags));
    }
docs: Ends the work performed on behalf of a transaction branch. The resource manager disassociates
  the XA resource from the transaction branch specified and lets the transaction complete.
  <p>If TMSUSPEND is specified in the flags, the transaction branch is temporarily suspended in
  an incomplete state. The transaction context is in a suspended state and must be resumed via
  the start method with TMRESUME specified.</p>
  <p>If TMFAIL is specified, the portion of work has failed. The resource manager may mark the
  transaction as rollback-only</p>
  <p>If TMSUCCESS is specified, the portion of work has completed successfully.</p>
  
  @param xid   A global transaction identifier that is the same as the identifier used previously
  in the start method.
  @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.
  @throws XAException An error has occurred. (XAException values are XAER_RMERR, XAER_RMFAILED,
  XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB*)