docs: @Override
    public void recordActivityEnd(ExecutionEntity executionEntity, String deleteReason) {
      if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        HistoricActivityInstanceEntity historicActivityInstance = findActivityInstance(executionEntity, false, true);
        if (historicActivityInstance != null) {
          historicActivityInstance.markEnded(deleteReason);
          
          // Fire event
          ActivitiEventDispatcher activitiEventDispatcher = getEventDispatcher();
          if (activitiEventDispatcher != null && activitiEventDispatcher.isEnabled()) {
            activitiEventDispatcher.dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
          }
        }
      }
    }