Factor failure detector into its own file, to be used by multiple schedu...

...lers

@apanda mind reviewing this?