code & unit test for spark context hang detection logic

If case class definition removes (), then remove () here as well.