ZOOKEEPER-3510: Make 'zkServer.sh stop' more reliable
ZOOKEEPER-3510: Make 'zkServer.sh stop' more reliable

As mentioned in https://github.com/apache/zookeeper/pull/1054#discussion_r314208678 :

There is a `sleep 3` statement in `zkServer.sh restart`. I am unable to unearth the history of that particular line, but I believe part—if not all—of that sleep should be part of `zkServer.sh stop`.

I frequently observe `FAILED TO START` errors in the C test suite; the logs consistently show that those are caused by `java.net.BindException: Address already in use`. Adding a simple `sleep 1` before `echo STOPPED` "fixes" it for me.

As noted in the commit message, the `sleep` is far from optimal, an adaptive mechanism would be better—but I do not want to make the first iteration too complicated.

Author: Damien Diederen <dd@crosstwine.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Norbert Kalmar <nkalmar@apache.org>

Closes #1055 from ztzg/ZOOKEEPER-3510-zkserver-stop-delay

apache/zookeeper,hanm/zookeeper,maoling/zookeeper,apache/zookeeper,apache/zookeeper,apache/zookeeper,apache/zookeeper,arshadmohammad/zookeeper,hanm/zookeeper,arshadmohammad/zookeeper,hanm/zookeeper,hanm/zookeeper,apache/zookeeper,hanm/zookeeper,hanm/zookeeper,maoling/zookeeper,arshadmohammad/zookeeper,arshadmohammad/zookeeper,maoling/zookeeper,maoling/zookeeper,arshadmohammad/zookeeper,arshadmohammad/zookeeper,arshadmohammad/zookeeper,maoling/zookeeper,arshadmohammad/zookeeper,apache/zookeeper,apache/zookeeper,hanm/zookeeper,maoling/zookeeper,maoling/zookeeper,hanm/zookeeper,maoling/zookeeper