code: @Override
    public void commit(Xid xid, boolean onePhase) throws XAException {
      synchronized (cpoXaStateMap) {
        CpoXaState<T> cpoXaState = cpoXaStateMap.getXidStateMap().get(xid);
  
        if (cpoXaState == null)
          throw CpoXaError.createXAException(CpoXaError.XAER_NOTA, "Unknown XID");
  
        if (cpoXaState.getAssociation()==CpoXaState.XA_UNASSOCIATED) {
          if (onePhase) {
            if (!cpoXaState.isSuccess()) {
              rollbackResource(cpoXaState.getResource());
              cpoXaState.setSuccess(true);
              throw CpoXaError.createXAException(CpoXaError.XA_RBROLLBACK, "Trying to commit an unsuccessful transaction. Transaction Rolled Back");
            }
            prepareResource(cpoXaState.getResource());
          }
          commitResource(cpoXaState.getResource());
          cpoXaState.setPrepared(false);
        } else {
          throw CpoXaError.createXAException(CpoXaError.XAER_PROTO, "Commit can only be called on an unassociated XID");
        }
      }
    }
docs: Commits the global transaction specified by xid.
  
  @param xid      - A global transaction identifier
  @param onePhase - If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.
  @throws XAException - An error has occurred. Possible XAExceptions are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
  XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
  <p>
  If the resource manager did not commit the transaction and the parameter onePhase is set to true, the resource manager may throw
  one of the XA_RB* exceptions. Upon return, the resource manager has rolled back the branch's work and has released all held resources.