Improve spark worker hang detection logic

1. Previous detection logic only detects for a single master spark cluster. With this improvement, it can detect multiple masters.
2. fix the http connector time out issue.
3. fix some logging issues.
4. fix some minor code formatting issues