Switches to master role in a separate thread

just like the switching to slave. This is done because switching to master
used to happen in the same thread handling the state change, directly from
the state machines (via a state change listener). The state machines
framework is designed such that handling and processing of messages must
be instantaneous. No waiting or costly operations should occur as part of
handling a message, since such will block all other state machine message
handling from occuring.

With this change a switch operation will be scheduled and started in the
very near future, but executed by another thread so that the actual state
transition handling is quick.

The issue this fixes is that heart beats were blocked during a master
switch so that after a master switch was completed and the new master came
up there were immediately suspicions against it and some rather
unnecessary switching occuring as part of it.