private Runnable extendLease(Task task, CompletableFuture<Task> taskCompletableFuture) {
        return () -> {
            if (taskCompletableFuture.isDone()) {
                LOGGER.warn(
                        "Task processing for {} completed, but its lease extend was not cancelled",
                        task.getTaskId());
                return;
            }
            LOGGER.info("Attempting to extend lease for {}", task.getTaskId());
            try {
                TaskResult result = new TaskResult(task);
                result.setExtendLease(true);
                retryOperation(
                        (TaskResult taskResult) -> {
                            taskClient.updateTask(taskResult);
                            return null;
                        },
                        LEASE_EXTEND_RETRY_COUNT,
                        result,
                        "extend lease");
                MetricsContainer.incrementTaskLeaseExtendCount(task.getTaskDefName(), 1);
            } catch (Exception e) {
                MetricsContainer.incrementTaskLeaseExtendErrorCount(task.getTaskDefName(), e);
                LOGGER.error("Failed to extend lease for {}", task.getTaskId(), e);
            }
        };
    }
Manages the threadpool used by the workers for execution and server communication (polling and
task update).
client/src/main/java/com/netflix/conductor/client/automator/TaskPollExecutor.java