accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [03/12] accumulo git commit: ACCUMULO-3516 Use verbose flag in ZooZap
Date Fri, 23 Jan 2015 22:26:49 GMT
ACCUMULO-3516 Use verbose flag in ZooZap


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9d479e2f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9d479e2f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9d479e2f

Branch: refs/heads/master
Commit: 9d479e2fade23a0dbee6e19a08e340e7d874b29c
Parents: 2016ab9
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Fri Jan 23 16:23:25 2015 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Fri Jan 23 16:23:25 2015 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/server/util/ZooZap.java   | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9d479e2f/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java b/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
index fe1cc3c..f9bb208 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
@@ -30,10 +30,8 @@ import com.beust.jcommander.Parameter;
 
 public class ZooZap {
 
-  static boolean verbose = false;
-
-  private static void message(String msg) {
-    if (verbose)
+  private static void message(String msg, Opts opts) {
+    if (opts.verbose)
       System.out.println(msg);
   }
 
@@ -63,7 +61,7 @@ public class ZooZap {
     if (opts.zapMaster) {
       String masterLockPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK;
 
-      zapDirectory(zoo, masterLockPath);
+      zapDirectory(zoo, masterLockPath, opts);
     }
 
     if (opts.zapTservers) {
@@ -71,7 +69,7 @@ public class ZooZap {
       try {
         List<String> children = zoo.getChildren(tserversPath);
         for (String child : children) {
-          message("Deleting " + tserversPath + "/" + child + " from zookeeper");
+          message("Deleting " + tserversPath + "/" + child + " from zookeeper", opts);
 
           if (opts.zapMaster)
             ZooReaderWriter.getInstance().recursiveDelete(tserversPath + "/" + child, NodeMissingPolicy.SKIP);
@@ -79,7 +77,7 @@ public class ZooZap {
             String path = tserversPath + "/" + child;
             if (zoo.getChildren(path).size() > 0) {
               if (!ZooLock.deleteLock(path, "tserver")) {
-                message("Did not delete " + tserversPath + "/" + child);
+                message("Did not delete " + tserversPath + "/" + child, opts);
               }
             }
           }
@@ -91,16 +89,16 @@ public class ZooZap {
 
     if (opts.zapTracers) {
       String path = Constants.ZROOT + "/" + iid + Constants.ZTRACERS;
-      zapDirectory(zoo, path);
+      zapDirectory(zoo, path, opts);
     }
 
   }
 
-  private static void zapDirectory(IZooReaderWriter zoo, String path) {
+  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");
+        message("Deleting " + path + "/" + child + " from zookeeper", opts);
         zoo.recursiveDelete(path + "/" + child, NodeMissingPolicy.SKIP);
       }
     } catch (Exception e) {


Mime
View raw message