Only modify threads if allowed to by the environment
Prepare heartbeat sender to use our own thread factory