spring-projects/spring-xd — pull request #1310 by pperalta (2014-12-01 19:44:12+00:00)
Title: XD-2331: Single node recovery on disconnect / XD-2373: Distributed test should verify container shutdown

When a single node server disconnects and reconnects to ZK (for instance when running on a laptop that goes to sleep) the leader election routine was failing an assert because the `CuratorFramework` was not in `STARTED` state. This was happening because the container listener forces a client shutdown and reconnect to guarantee that all its ephemeral nodes are cleaned up. This connection is the same one being passed to the leader election routine.

The fix is to only force the container to recreate the `CuratorFramework` if it is not in the `STARTED` state. The state transition of `SUSPENDED` -> `LOST` -> `RECONNECTED` where the framework has restarted seems to happen consistently when the machine running the process goes to sleep and wakes up.

XD-2373: Distributed test should verify container shutdown

After each test, block execution until admin indicates that all containers have been unregistered from ZK.

Destroy streams before container shutdown

Increased state transition timeout

Some tests require deployment to a container after it joins the cluster. Since there is a mandatory waiting period before new containers are assigned deployments (15 seconds by default) the wait period for the verify stream/job state methods has been increased.