Repository: accumulo Updated Branches: refs/heads/1.6 7efbbd5dd -> 82f173496
ACCUMULO-4163: change exception handling Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/82f17349 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/82f17349 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/82f17349 Branch: refs/heads/1.6 Commit: 82f173496b2d71b9cc586b4870169ca64f89cdd6 Parents: 7efbbd5 Author: Dave Marion <dlmar...@apache.org> Authored: Mon Aug 22 18:42:56 2016 -0400 Committer: Dave Marion <dlmar...@apache.org> Committed: Mon Aug 22 18:42:56 2016 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/server/util/ZooZap.java | 27 ++++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/82f17349/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java index f9bb208..5a8f8bd 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java @@ -24,6 +24,7 @@ import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy; import org.apache.accumulo.server.cli.ClientOpts; import org.apache.accumulo.server.zookeeper.ZooLock; import org.apache.accumulo.server.zookeeper.ZooReaderWriter; +import org.apache.zookeeper.KeeperException; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; @@ -61,7 +62,11 @@ public class ZooZap { if (opts.zapMaster) { String masterLockPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK; - zapDirectory(zoo, masterLockPath, opts); + try { + zapDirectory(zoo, masterLockPath, opts); + } catch (Exception e) { + e.printStackTrace(); + } } if (opts.zapTservers) { @@ -89,20 +94,20 @@ public class ZooZap { if (opts.zapTracers) { String path = Constants.ZROOT + "/" + iid + Constants.ZTRACERS; - zapDirectory(zoo, path, opts); + try { + zapDirectory(zoo, path, opts); + } catch (Exception e) { + // do nothing if the /tracers node does not exist. + } } } - private static void zapDirectory(IZooReaderWriter zoo, String path, Opts opts) { - try { - List<String> children = zoo.getChildren(path); - for (String child : children) { - message("Deleting " + path + "/" + child + " from zookeeper", opts); - zoo.recursiveDelete(path + "/" + child, NodeMissingPolicy.SKIP); - } - } catch (Exception e) { - e.printStackTrace(); + private static void zapDirectory(IZooReaderWriter zoo, String path, Opts opts) throws KeeperException, InterruptedException { + List<String> children = zoo.getChildren(path); + for (String child : children) { + message("Deleting " + path + "/" + child + " from zookeeper", opts); + zoo.recursiveDelete(path + "/" + child, NodeMissingPolicy.SKIP); } } }