presto-main/src/main/java/io/prestosql/execution/TaskStateMachine.java/TaskStateMachine/TaskStateMachine
class TaskStateMachine:    public TaskStateMachine(TaskId taskId, Executor executor)
    {
        this.taskId = requireNonNull(taskId, "taskId is null");
        taskState = new StateMachine<>("task " + taskId, executor, TaskState.RUNNING, TERMINAL_TASK_STATES);
        taskState.addStateChangeListener(new StateChangeListener<TaskState>()
        {
            @Override
            public void stateChanged(TaskState newState)
            {
                log.debug("Task %s is %s", taskId, newState);
            }
        });
    }