code: private Runnable createStopTask() {
      return new Runnable() {
        @Override
        public void run() {
          try {
            // Close the ZK connection in this task will make sure if there is ZK connection created
            // after doStop() was called but before this task has been executed is also closed.
            // It is possible to happen when the following sequence happens:
            //
            // 1. session expired, hence the expired event is triggered
            // 2. The reconnect task executed. With Service.state() == RUNNING, it creates a new ZK client
            // 3. Service.stop() gets called, Service.state() changed to STOPPING
            // 4. The new ZK client created from the reconnect thread update the zooKeeper with the new one
            closeZooKeeper(zooKeeper.getAndSet(null));
            notifyStopped();
          } catch (Exception e) {
            notifyFailed(e);
          }
        }
      };
    }
docs: Creates a {@link Runnable} task that will get executed in the event executor for transiting this
  Service into STOPPED state.