code: int completeTransaction(Xid xid, boolean commit) {
        try {
           TransactionOperationFactory factory = assertStartedAndReturnFactory();
           CompleteTransactionOperation operation = factory.newCompleteTransactionOperation(xid, commit);
           return operation.execute().get();
        } catch (Exception e) {
           getLog().debug("Exception while commit/rollback.", e);
           return XAException.XA_HEURRB; //heuristically rolled-back
        }
     }
docs: It completes the transaction with the commit or rollback request.
  <p>
  It can be a commit or rollback request.
  
  @param xid    The transaction {@link Xid}.
  @param commit {@code True} to commit the transaction, {@link false} to rollback.
  @return The server's return code.