code: @Override
    public void recordTaskEnd(String taskId, String deleteReason) {
      if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
        HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(taskId);
        if (historicTaskInstance != null) {
          historicTaskInstance.markEnded(deleteReason);
        }
      }
    }
docs: /*
  (non-Javadoc)
  
  @see org.activiti.engine.impl.history.HistoryManagerInterface#recordTaskEnd (java.lang.String, java.lang.String)