accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject git commit: ACCUMULO-1778 added utility for obtaining monitor location
Date Wed, 16 Oct 2013 16:38:21 GMT
Updated Branches:
  refs/heads/master 544d0f30c -> 493fc03f1


ACCUMULO-1778 added utility for obtaining monitor location


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

Branch: refs/heads/master
Commit: 493fc03f1cf19c1d5cdb4335d706de4aaa039234
Parents: 544d0f3
Author: Billie Rinaldi <billie.rinaldi@gmail.com>
Authored: Wed Oct 16 09:37:24 2013 -0700
Committer: Billie Rinaldi <billie.rinaldi@gmail.com>
Committed: Wed Oct 16 09:37:24 2013 -0700

----------------------------------------------------------------------
 .../apache/accumulo/core/util/MonitorUtil.java  | 31 ++++++++++++++++++++
 .../org/apache/accumulo/server/util/Info.java   |  7 ++---
 .../test/functional/ConfigurableMacIT.java      |  7 ++---
 3 files changed, 35 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/493fc03f/core/src/main/java/org/apache/accumulo/core/util/MonitorUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/MonitorUtil.java b/core/src/main/java/org/apache/accumulo/core/util/MonitorUtil.java
new file mode 100644
index 0000000..158a170
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/util/MonitorUtil.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.zookeeper.ZooReader;
+import org.apache.zookeeper.KeeperException;
+
+public class MonitorUtil {
+  public static String getLocation(Instance instance) throws KeeperException, InterruptedException
{
+    ZooReader zr = new ZooReader(instance.getZooKeepers(), 5000);
+    byte[] loc = zr.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, null);
+    return loc==null ? null : new String(loc);
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/493fc03f/server/src/main/java/org/apache/accumulo/server/util/Info.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Info.java b/server/src/main/java/org/apache/accumulo/server/util/Info.java
index 4f03d82..29fa135 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Info.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Info.java
@@ -16,17 +16,14 @@
  */
 package org.apache.accumulo.server.util;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.core.util.MonitorUtil;
 import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
 public class Info {
   public static void main(String[] args) throws Exception {
-    ZooReaderWriter zrw = ZooReaderWriter.getInstance();
     Instance instance = HdfsZooInstance.getInstance();
-    System.out.println("monitor: " + new String(zrw.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR,
null)));
+    System.out.println("monitor: " + MonitorUtil.getLocation(instance));
     System.out.println("masters: " + instance.getMasterLocations());
     System.out.println("zookeepers: " + instance.getZooKeepers());
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/493fc03f/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
index 597f385..3f60f1d 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
@@ -18,14 +18,12 @@ package org.apache.accumulo.test.functional;
 
 import java.io.IOException;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.accumulo.fate.zookeeper.ZooReader;
+import org.apache.accumulo.core.util.MonitorUtil;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
 import org.apache.accumulo.minicluster.MiniAccumuloConfig;
 import org.apache.log4j.Logger;
@@ -73,8 +71,7 @@ public class ConfigurableMacIT extends AbstractMacIT {
 
   public String getMonitor() throws KeeperException, InterruptedException {
     Instance instance = new ZooKeeperInstance(getCluster().getInstanceName(), getCluster().getZooKeepers());
-    ZooReader zr = new ZooReader(getCluster().getZooKeepers(), 5000);
-    return new String(zr.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, null));
+    return MonitorUtil.getLocation(instance);
   }
 
 }


Mime
View raw message