public List<Exception> markTaskCompleted() {
        completed = true;
        List<Exception> errMsgs = new ArrayList<>();
        onCompleteCallbacks.forEach(e -> {
            try {
                e.accept(this);
            } catch (Exception ex) {
                errMsgs.add(ex);
                log.error("Error in task completion listener", ex);
            }
        });
        return errMsgs;
    }
Marks the task as completed and triggers the listeners.
indexr-query-opt/src/main/java/io/indexr/query/TaskContextImpl.java