code: void abortProcessInstance(InternalEvent event)
        throws ProcessException {
          Long processId = event.getWorkId();
          String processOwner = event.getOwnerType();
          Long processOwnerId = event.getOwnerId();
          Long processInstId = event.getWorkInstanceId();
          try {
              if (processInstId!=null && processInstId.longValue()!=0L) {
                  ProcessInstance pi = edao.getProcessInstance(processInstId);
                  cancelProcessInstanceTree(pi);
                  if (logger.isInfoEnabled()) {
                      logger.info(logtag(pi.getProcessId(), pi.getId(), pi.getMasterRequestId()), "Process cancelled");
                  }
              } else {
                  List<ProcessInstance> coll = edao.getProcessInstances(processId, processOwner, processOwnerId);
                  if (coll == null || coll.isEmpty()) {
                      logger.info("No Process Instances for the Process and Owner");
                      return;
                  }
                  for (ProcessInstance pi : coll) {
                      // there really should have only one
                      cancelProcessInstanceTree(pi);
                  }
              }
          }
          catch (Exception ex) {
              logger.severeException(ex.getMessage(), ex);
              throw new ProcessException(ex.getMessage());
          }
      }
docs: Abort a single process instance by process instance ID,
  or abort potentially multiple (but typically one) process instances
  by process ID and owner ID.