private void finalizeTask(Task task, Throwable throwable) {
        if (throwable != null) {
            LOGGER.error(
                    "Error processing task: {} of type: {}",
                    task.getTaskId(),
                    task.getTaskType(),
                    throwable);
            MetricsContainer.incrementTaskExecutionErrorCount(task.getTaskType(), throwable);
        } else {
            LOGGER.debug(
                    "Task:{} of type:{} finished processing with status:{}",
                    task.getTaskId(),
                    task.getTaskDefName(),
                    task.getStatus());
            String taskId = task.getTaskId();
            ScheduledFuture<?> leaseExtendFuture = leaseExtendMap.get(taskId);
            if (leaseExtendFuture != null) {
                leaseExtendFuture.cancel(true);
                leaseExtendMap.remove(taskId);
            }
        }
    }
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