presto-main/src/main/java/io/prestosql/execution/StageStateMachine.java/StageStateMachine/transitionToFinished
class StageStateMachine:    public boolean transitionToFinished()
    {
        return stageState.setIf(FINISHED, currentState -> !currentState.isDone());
    }