[SPARK-3101] Flag variable in ApplicationMaster should be declared as volatile