added a wait mechansim for blocking main application thread until cluster shuts down