The new code is actually better.
1. Is there any fault in the new code?
It looks good to me
2. Compared to previous approach and this, which one is overall better and should be recommended over another?
Second approach
3. Can I update the new code to make it better? Or any better graceful shutdown approach?
This pattern is the idiomatic way to handle graceful shutdown, for most cases this is the best way to handle graceful shutdown