Repository: curator Updated Branches: refs/heads/CURATOR-411 88d56219e -> 96cecb2bb
don't clear quorumPeer as it might cause an NPE Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fb972db6 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fb972db6 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fb972db6 Branch: refs/heads/CURATOR-411 Commit: fb972db618eec11d350fc490010b014b8e3523fc Parents: 88d5621 Author: randgalt <[email protected]> Authored: Wed May 10 13:32:52 2017 +0200 Committer: randgalt <[email protected]> Committed: Wed May 10 13:32:52 2017 +0200 ---------------------------------------------------------------------- .../apache/curator/test/TestingQuorumPeerMain.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/fb972db6/curator-test/src/main/java/org/apache/curator/test/TestingQuorumPeerMain.java ---------------------------------------------------------------------- diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingQuorumPeerMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingQuorumPeerMain.java index 3ae464c..3b3ab26 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingQuorumPeerMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingQuorumPeerMain.java @@ -27,6 +27,8 @@ import java.nio.channels.ServerSocketChannel; class TestingQuorumPeerMain extends QuorumPeerMain implements ZooKeeperMainFace { + private volatile boolean isClosed = false; + @Override public void kill() { @@ -60,16 +62,10 @@ class TestingQuorumPeerMain extends QuorumPeerMain implements ZooKeeperMainFace @Override public void close() throws IOException { - if ( quorumPeer != null ) + if ( (quorumPeer != null) && !isClosed ) { - try - { - quorumPeer.shutdown(); - } - finally - { - quorumPeer = null; - } + isClosed = true; + quorumPeer.shutdown(); } }
