Bug fix: SPARK-796
according to mridulm's comments to adjust the code
set SUCCEEDED for all master in shutdown hook
add spaces before curly braces  and after for if conditions
Merge pull request #689 from BlackNiuza/application_status

Bug fix: SPARK-796