Uses the cancellation request to replace interruption for state changing tasks

This interface captures the notion of the request to cancel a
 running task. This involves the actual checking but not the
 notification mechanism, which is application dependent.
The driver for this is properly cancelling state change in HA

Removes the use of Thread.interrupt() for cancelling the task that is
 currently switching state. Interruption had the capacity to cause
 unwanted side effects to IO operations.
The Future that is attached to the currently running task is actually
 waited for, ensuring no two threads are stepping on each other's toes
The SwitchToSlave task checks at convenient points during the store copy
 if cancellation has been requested and properly aborts, while cleaning
 up. This will be revisited
Adds comments to key methods and adjusts a test to work with the new way
 of cancelling.

Refactors master HA URI to make structure more clear

Adds two cancellation points in SwitchToSlave

Adds defensive check for switching to slave for ourselves as master

Also adds a catch clause around the get() for the Future of the
 task switching, when there is the need for cancellation
Adds a test for the added check
Merge pull request #2831 from digitalstain/1.9-cancel-state-switch

Properly cancel state switch tasks