public ResultPage<TaskProgress> find(final FindTaskProgressCriteria findTaskProgressCriteria) {
        final boolean sessionMatch = findTaskProgressCriteria != null &&
                                     findTaskProgressCriteria.getSessionId() != null &&
                                     findTaskProgressCriteria.getSessionId().equals(sessionIdProvider.get());

        if (sessionMatch) {
            // Always allow a user to see tasks for their own session if tasks for the current session
            // have been requested.
            return doFind(findTaskProgressCriteria);
        } else {
            return securityContext.secureResult(AppPermission.MANAGE_TASKS_PERMISSION, () ->
                    doFind(findTaskProgressCriteria));
        }
    }
Tells tasks to terminate and waits for all tasks to terminate before
cleaning up the executors.
stroom-task/stroom-task-impl/src/main/java/stroom/task/impl/TaskManagerImpl.java