accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [04/16] git commit: checkpointing before rejiggering watchers. This is a functionally broken commit
Date Mon, 22 Sep 2014 20:48:04 GMT
checkpointing before rejiggering watchers. This is a functionally broken commit



git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/ACCUMULO-CURATOR@1495223 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/ACCUMULO-CURATOR
Commit: 518844b5748dfdaee690dc1c3ea0db20153219ea
Parents: 7f6e98c
Author: John Vines <vines@apache.org>
Authored: Thu Jun 20 22:56:43 2013 +0000
Committer: John Vines <vines@apache.org>
Committed: Thu Jun 20 22:56:43 2013 +0000

----------------------------------------------------------------------
 assemble/pom.xml                                |   4 +
 assemble/src/main/assemblies/component.xml      |  16 +
 core/pom.xml                                    |   9 +-
 .../accumulo/core/client/ZooKeeperInstance.java |  26 +-
 .../client/admin/InstanceOperationsImpl.java    |  13 +-
 .../accumulo/core/client/impl/ServerClient.java |   9 +-
 .../accumulo/core/client/impl/Tables.java       |  24 +-
 fate/pom.xml                                    |  34 +-
 .../accumulo/fate/zookeeper/ZooCache.java       | 313 ++++++-------------
 .../apache/accumulo/fate/zookeeper/ZooLock.java |  44 ++-
 .../apache/accumulo/fate/zookeeper/ZooUtil.java |   9 +-
 minicluster/pom.xml                             |   9 +-
 pom.xml                                         |  19 +-
 proxy/pom.xml                                   |   4 +-
 server/pom.xml                                  |   9 +-
 .../accumulo/server/client/HdfsZooInstance.java |   9 +-
 .../server/conf/TableConfiguration.java         |  15 +-
 .../accumulo/server/conf/ZooConfiguration.java  |  21 +-
 .../accumulo/server/master/LiveTServerSet.java  |  11 +-
 .../apache/accumulo/server/master/Master.java   |  14 +-
 .../accumulo/server/master/state/ZooStore.java  |   8 +-
 .../master/state/tables/TableManager.java       |  11 +-
 .../server/security/SecurityOperation.java      |   2 +-
 .../security/handler/ZKAuthenticator.java       |   9 +-
 .../server/security/handler/ZKAuthorizor.java   |   2 +-
 .../server/security/handler/ZKPermHandler.java  |  27 +-
 .../accumulo/server/util/ListInstances.java     |   2 +-
 .../accumulo/server/util/MetadataTable.java     |  20 +-
 .../accumulo/server/util/TabletServerLocks.java |   2 +-
 .../accumulo/server/zookeeper/ZooCache.java     |  12 +-
 test/pom.xml                                    |   9 +-
 .../test/functional/CacheTestReader.java        |   6 +-
 trace/pom.xml                                   |   9 +-
 33 files changed, 306 insertions(+), 425 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/assemble/pom.xml
----------------------------------------------------------------------
diff --git a/assemble/pom.xml b/assemble/pom.xml
index db40b65..9d727b5 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -87,6 +87,10 @@
       <artifactId>commons-vfs2</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.thrift</groupId>
       <artifactId>libthrift</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/assemble/src/main/assemblies/component.xml
----------------------------------------------------------------------
diff --git a/assemble/src/main/assemblies/component.xml b/assemble/src/main/assemblies/component.xml
index 3655a22..781f511 100644
--- a/assemble/src/main/assemblies/component.xml
+++ b/assemble/src/main/assemblies/component.xml
@@ -39,6 +39,22 @@
       </excludes>
     </dependencySet>
     <dependencySet>
+      <outputDirectory>lib</outputDirectory>
+      <directoryMode>0755</directoryMode>
+      <fileMode>0644</fileMode>
+      <useProjectArtifact>true</useProjectArtifact>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <useTransitiveDependencies>true</useTransitiveDependencies>
+      <includes>
+        <include>org.apache.curator:curator-framework</include>
+        <include>org.apache.curator:curator-client</include>
+        <include>org.apache.curator:curator-recipes</include>
+      </includes>
+      <excludes>
+        <exclude>${groupId}:${artifactId}-docs</exclude>
+      </excludes>
+    </dependencySet>
+    <dependencySet>
       <outputDirectory>docs</outputDirectory>
       <directoryMode>0755</directoryMode>
       <fileMode>0644</fileMode>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 640f4a8..4c64c1b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -50,6 +50,10 @@
       <artifactId>commons-vfs2</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.thrift</groupId>
       <artifactId>libthrift</artifactId>
     </dependency>
@@ -99,11 +103,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 8f62f8f..d1f7239 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -38,7 +38,9 @@ import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -140,7 +142,7 @@ public class ZooKeeperInstance implements Instance {
       // want the instance id to be stable for the life of this instance object,
       // so only get it once
       String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + instanceName;
-      byte[] iidb = zooCache.get(instanceNamePath);
+      byte[] iidb = zooCache.get(instanceNamePath).getData();
       if (iidb == null) {
         throw new RuntimeException("Instance name " + instanceName
             + " does not exist in zookeeper.  Run \"accumulo org.apache.accumulo.server.util.ListInstances\" to see a list.");
@@ -177,14 +179,14 @@ public class ZooKeeperInstance implements Instance {
     String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
     
     OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zookeeper.");
-    byte[] loc = zooCache.get(zRootLocPath);
-    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+    ChildData loc = zooCache.get(zRootLocPath);
+    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc.getData())) + " in %DURATION%");
     
     if (loc == null) {
       return null;
     }
     
-    return new String(loc).split("\\|")[0];
+    return new String(loc.getData()).split("\\|")[0];
   }
   
   @Override
@@ -248,14 +250,6 @@ public class ZooKeeperInstance implements Instance {
   }
   
   /**
-   * @deprecated Use {@link #lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache, UUID)} instead
-   */
-  @Deprecated
-  public static String lookupInstanceName(org.apache.accumulo.core.zookeeper.ZooCache zooCache, UUID instanceId) {
-    return lookupInstanceName((ZooCache) zooCache, instanceId);
-  }
-  
-  /**
    * Given a zooCache and instanceId, look up the instance name.
    * 
    * @param zooCache
@@ -264,11 +258,11 @@ public class ZooKeeperInstance implements Instance {
    */
   public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) {
     ArgumentChecker.notNull(zooCache, instanceId);
-    for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) {
-      String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name;
-      UUID iid = UUID.fromString(new String(zooCache.get(instanceNamePath)));
+    String path = Constants.ZROOT + Constants.ZINSTANCES;
+    for (ChildData name : zooCache.getChildren(path)) {
+      UUID iid = UUID.fromString(new String(name.getData()));
       if (iid.equals(instanceId)) {
-        return name;
+        return CuratorUtil.getNodeName(name);
       }
     }
     return null;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
index d608cf8..44f6554 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
@@ -41,8 +41,10 @@ import org.apache.accumulo.core.util.AddressUtil;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.thrift.TException;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
@@ -133,20 +135,19 @@ public class InstanceOperationsImpl implements InstanceOperations {
    * 
    * @see org.apache.accumulo.core.client.admin.InstanceOperations#getTabletServers()
    */
-  
   @Override
   public List<String> getTabletServers() {
     ZooCache cache = ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
     String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
     List<String> results = new ArrayList<String>();
-    for (String candidate : cache.getChildren(path)) {
-      List<String> children = cache.getChildren(path + "/" + candidate);
+    for (ChildData candidate : cache.getChildren(path)) {
+      List<ChildData> children = cache.getChildren(path + "/" + candidate);
       if (children != null && children.size() > 0) {
-        List<String> copy = new ArrayList<String>(children);
+        List<ChildData> copy = new ArrayList<ChildData>(children);
         Collections.sort(copy);
-        byte[] data = cache.get(path + "/" + candidate + "/" + copy.get(0));
+        byte[] data = copy.get(0).getData();
         if (data != null && !"master".equals(new String(data))) {
-          results.add(candidate);
+          results.add(CuratorUtil.getNodeName(candidate));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
index b933c2b..7773979 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
@@ -25,8 +25,8 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.thrift.ClientService;
-import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.client.impl.thrift.ClientService.Client;
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.ArgumentChecker;
@@ -37,6 +37,7 @@ import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
@@ -48,7 +49,7 @@ public class ServerClient {
   private synchronized static ZooCache getZooCache(Instance instance) {
     ZooCache result = zooCaches.get(instance.getZooKeepers());
     if (result == null) {
-      result = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), null);
+      result = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
       zooCaches.put(instance.getZooKeepers(), result);
     }
     return result;
@@ -135,8 +136,8 @@ public class ServerClient {
     
     // add tservers
     ZooCache zc = getZooCache(instance);
-    for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
-      String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
+    for (ChildData tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
+      String path = tserver.getPath();
       byte[] data = ZooUtil.getLockData(zc, path);
       if (data != null && !new String(data).equals("master"))
         servers.add(new ThriftTransportKey(

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index 8bc725a..75d22e5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -27,7 +27,9 @@ import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
+import org.apache.curator.framework.recipes.cache.ChildData;
 
 public class Tables {
   private static SecurityPermission TABLES_PERMISSION = new SecurityPermission("tablesPermission");
@@ -43,17 +45,17 @@ public class Tables {
   private static SortedMap<String,String> getMap(Instance instance, boolean nameAsKey) {
     ZooCache zc = getZooCache(instance);
     
-    List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
+    List<ChildData> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
     
     TreeMap<String,String> tableMap = new TreeMap<String,String>();
     
-    for (String tableId : tableIds) {
-      byte[] tblPath = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME);
-      if (tblPath != null) {
+    for (ChildData tableId : tableIds) {
+      ChildData namePath = zc.get(tableId.getPath() + Constants.ZTABLE_NAME);
+      if (namePath != null) {
         if (nameAsKey)
-          tableMap.put(new String(tblPath), tableId);
+          tableMap.put(new String(namePath.getData()), CuratorUtil.getNodeName(tableId));
         else
-          tableMap.put(tableId, new String(tblPath));
+          tableMap.put(CuratorUtil.getNodeName(tableId), new String(namePath.getData()));
       }
     }
     
@@ -84,8 +86,8 @@ public class Tables {
   
   public static boolean exists(Instance instance, String tableId) {
     ZooCache zc = getZooCache(instance);
-    List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
-    return tableIds.contains(tableId);
+    ChildData table = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + '/' + tableId);
+    return table != null;
   }
   
   public static void clearCache(Instance instance) {
@@ -107,7 +109,7 @@ public class Tables {
     try {
       tableName = getTableName(instance, tableId);
     } catch (TableNotFoundException e) {
-      //handled in the string formatting
+      // handled in the string formatting
     }
     return tableName == null ? String.format("?(ID:%s)", tableId) : String.format("%s(ID:%s)", tableName, tableId);
   }
@@ -117,7 +119,7 @@ public class Tables {
     try {
       tableId = getTableId(instance, tableName);
     } catch (TableNotFoundException e) {
-      //handled in the string formatting
+      // handled in the string formatting
     }
     return tableId == null ? String.format("%s(?)", tableName) : String.format("%s(ID:%s)", tableName, tableId);
   }
@@ -125,7 +127,7 @@ public class Tables {
   public static TableState getTableState(Instance instance, String tableId) {
     String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
     ZooCache zc = getZooCache(instance);
-    byte[] state = zc.get(statePath);
+    byte[] state = zc.get(statePath).getData();
     if (state == null)
       return TableState.UNKNOWN;
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/fate/pom.xml
----------------------------------------------------------------------
diff --git a/fate/pom.xml b/fate/pom.xml
index 1d7a7bf..51991c1 100644
--- a/fate/pom.xml
+++ b/fate/pom.xml
@@ -1,20 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
+<!-- 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. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
@@ -26,6 +15,14 @@
   <name>Fate</name>
   <dependencies>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-recipes</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
       <scope>provided</scope>
@@ -36,11 +33,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
index aa24552..9080ed9 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
@@ -16,25 +16,21 @@
  */
 package org.apache.accumulo.fate.zookeeper;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
-import java.util.Collections;
-import java.util.ConcurrentModificationException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.accumulo.fate.curator.CuratorUtil;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.recipes.cache.ChildData;
+import org.apache.curator.framework.recipes.cache.NodeCache;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode;
 import org.apache.log4j.Logger;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.Code;
-import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
 
 /**
  * Caches values stored in zookeeper and keeps them up to date as they change in zookeeper.
@@ -43,256 +39,151 @@ import org.apache.zookeeper.data.Stat;
 public class ZooCache {
   private static final Logger log = Logger.getLogger(ZooCache.class);
   
-  private ZCacheWatcher watcher = new ZCacheWatcher();
-  private Watcher externalWatcher = null;
+  private HashMap<String,NodeCache> nodeCache;
+  private HashMap<String,PathChildrenCache> childrenCache;
   
-  private HashMap<String,byte[]> cache;
-  private HashMap<String,Stat> statCache;
-  private HashMap<String,List<String>> childrenCache;
-  
-  private ZooReader zReader;
-  
-  private ZooKeeper getZooKeeper() {
-    return zReader.getZooKeeper();
-  }
-  
-  private class ZCacheWatcher implements Watcher {
-    @Override
-    public void process(WatchedEvent event) {
-      
-      if (log.isTraceEnabled())
-        log.trace(event);
-      
-      switch (event.getType()) {
-        case NodeDataChanged:
-        case NodeChildrenChanged:
-        case NodeCreated:
-        case NodeDeleted:
-          remove(event.getPath());
-          break;
-        case None:
-          switch (event.getState()) {
-            case Disconnected:
-              if (log.isTraceEnabled())
-                log.trace("Zoo keeper connection disconnected, clearing cache");
-              clear();
-              break;
-            case SyncConnected:
-              break;
-            case Expired:
-              if (log.isTraceEnabled())
-                log.trace("Zoo keeper connection expired, clearing cache");
-              clear();
-              break;
-            default:
-              log.warn("Unhandled: " + event);
-          }
-          break;
-        default:
-          log.warn("Unhandled: " + event);
-      }
-      
-      if (externalWatcher != null) {
-        externalWatcher.process(event);
-      }
-    }
-  }
+  private CuratorFramework curator;
   
   public ZooCache(String zooKeepers, int sessionTimeout) {
     this(zooKeepers, sessionTimeout, null);
   }
   
   public ZooCache(String zooKeepers, int sessionTimeout, Watcher watcher) {
-    this(new ZooReader(zooKeepers, sessionTimeout), watcher);
-  }
-  
-  public ZooCache(ZooReader reader, Watcher watcher) {
-    this.zReader = reader;
-    this.cache = new HashMap<String,byte[]>();
-    this.statCache = new HashMap<String,Stat>();
-    this.childrenCache = new HashMap<String,List<String>>();
-    this.externalWatcher = watcher;
+    this(CuratorUtil.constructCurator(zooKeepers, sessionTimeout, null), watcher);
   }
   
-  private static interface ZooRunnable {
-    void run(ZooKeeper zooKeeper) throws KeeperException, InterruptedException;
+  public ZooCache(CuratorFramework curator, Watcher watcher) {
+    this.curator = curator;
+    this.nodeCache = new HashMap<String,NodeCache>();
+    this.childrenCache = new HashMap<String,PathChildrenCache>();
   }
   
-  private synchronized void retry(ZooRunnable op) {
-    
-    int sleepTime = 100;
-    
-    while (true) {
-      
-      ZooKeeper zooKeeper = getZooKeeper();
-      
+  public synchronized List<ChildData> getChildren(final String zPath) {
+    PathChildrenCache cache = childrenCache.get(zPath);
+    if (cache == null) {
+      cache = new PathChildrenCache(curator, zPath, true);
       try {
-        op.run(zooKeeper);
-        return;
+        cache.start(StartMode.BUILD_INITIAL_CACHE);
         
-      } catch (KeeperException e) {
-        if (e.code() == Code.NONODE) {
-          log.error("Looked up non existant node in cache " + e.getPath(), e);
+        // Because parent's children are being watched, we don't need a node watcher on the individual node
+        for (ChildData child : cache.getCurrentData()) {
+          NodeCache childCache = nodeCache.get(child.getPath());
+          if (childCache != null)
+          {
+            childCache.close();
+            nodeCache.remove(child.getPath());
+          }
         }
-        log.warn("Zookeeper error, will retry", e);
-      } catch (InterruptedException e) {
-        log.info("Zookeeper error, will retry", e);
-      } catch (ConcurrentModificationException e) {
-        log.debug("Zookeeper was modified, will retry");
-      }
-      
-      try {
-        // do not hold lock while sleeping
-        wait(sleepTime);
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-      }
-      if (sleepTime < 10000)
-        sleepTime = (int) (sleepTime + sleepTime * Math.random());
-      
-    }
-  }
-  
-  public synchronized List<String> getChildren(final String zPath) {
-    
-    ZooRunnable zr = new ZooRunnable() {
-      
-      @Override
-      public void run(ZooKeeper zooKeeper) throws KeeperException, InterruptedException {
-        
-        if (childrenCache.containsKey(zPath))
-          return;
-        
+      } catch (Exception e) {
+        log.error(e, e);
         try {
-          List<String> children = zooKeeper.getChildren(zPath, watcher);
-          childrenCache.put(zPath, children);
-        } catch (KeeperException ke) {
-          if (ke.code() != Code.NONODE) {
-            throw ke;
-          }
+          cache.close();
+        } catch (IOException e1) {
+          // We're already in a bad state at this point, I think, but just in case
+          log.error(e, e);
         }
+        return null;
       }
-      
-    };
-    
-    retry(zr);
-    
-    List<String> children = childrenCache.get(zPath);
-    if (children == null) {
-      return null;
+      childrenCache.put(zPath, cache);
     }
-    return Collections.unmodifiableList(children);
+    return cache.getCurrentData();
   }
   
-  public synchronized byte[] get(final String zPath) {
-    return get(zPath, null);
+  public List<String> getChildKeys(final String zPath) {
+    List<String> toRet = new ArrayList<String>();
+    for (ChildData child : getChildren(zPath)) {
+      toRet.add(CuratorUtil.getNodeName(child));
+    }
+    return toRet;
   }
   
-  public synchronized byte[] get(final String zPath, Stat stat) {
-    ZooRunnable zr = new ZooRunnable() {
-      
-      @Override
-      public void run(ZooKeeper zooKeeper) throws KeeperException, InterruptedException {
-        
-        if (cache.containsKey(zPath))
-          return;
-        
-        /*
-         * The following call to exists() is important, since we are caching that a node does not exist. Once the node comes into existance, it will be added to
-         * the cache. But this notification of a node coming into existance will only be given if exists() was previously called.
-         * 
-         * If the call to exists() is bypassed and only getData() is called with a special case that looks for Code.NONODE in the KeeperException, then
-         * non-existance can not be cached.
-         */
-        
-        Stat stat = zooKeeper.exists(zPath, watcher);
-        
-        byte[] data = null;
-        
-        if (stat == null) {
-          if (log.isTraceEnabled())
-            log.trace("zookeeper did not contain " + zPath);
-        } else {
-          try {
-            data = zooKeeper.getData(zPath, watcher, stat);
-          } catch (KeeperException.BadVersionException e1) {
-            throw new ConcurrentModificationException();
-          } catch (KeeperException.NoNodeException e2) {
-            throw new ConcurrentModificationException();
-          }
-          if (log.isTraceEnabled())
-            log.trace("zookeeper contained " + zPath + " " + (data == null ? null : new String(data)));
-        }
-        if (log.isTraceEnabled())
-          log.trace("putting " + zPath + " " + (data == null ? null : new String(data)) + " in cache");
-        put(zPath, data, stat);
+  public synchronized ChildData get(final String zPath) {
+    NodeCache cache = nodeCache.get(zPath);
+    if (cache == null) {
+      PathChildrenCache cCache = childrenCache.get(CuratorUtil.getNodeParent(zPath));
+      if (cCache != null) {
+        return cCache.getCurrentData(zPath);
       }
-      
-    };
-    
-    retry(zr);
-    
-    if (stat != null) {
-      Stat cstat = statCache.get(zPath);
-      if (cstat != null) {
+      cache = new NodeCache(curator, zPath);
+      try {
+        cache.start(true);
+      } catch (Exception e) {
+        log.error(e, e);
         try {
-          ByteArrayOutputStream baos = new ByteArrayOutputStream();
-          DataOutputStream dos = new DataOutputStream(baos);
-          cstat.write(dos);
-          dos.close();
-          
-          ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-          DataInputStream dis = new DataInputStream(bais);
-          stat.readFields(dis);
-          
-          dis.close();
-        } catch (IOException e) {
-          throw new RuntimeException(e);
+          cache.close();
+        } catch (IOException e1) {
+          // We're already in a bad state at this point, I think, but just in case
+          log.error(e, e);
         }
+        return null;
       }
+      nodeCache.put(zPath, cache);
     }
     
-    return cache.get(zPath);
-  }
-  
-  private synchronized void put(String zPath, byte[] data, Stat stat) {
-    cache.put(zPath, data);
-    statCache.put(zPath, stat);
+    return cache.getCurrentData();
   }
   
   private synchronized void remove(String zPath) {
     if (log.isTraceEnabled())
       log.trace("removing " + zPath + " from cache");
-    cache.remove(zPath);
+    NodeCache nc = nodeCache.get(zPath);
+    if (nc != null) {
+      try {
+        nc.close();
+      } catch (IOException e) {
+        log.error(e, e);
+      }
+    }
+    
+    PathChildrenCache pc = childrenCache.get(zPath);
+    if (pc != null) {
+      try {
+        pc.close();
+      } catch (IOException e) {
+        log.error(e, e);
+      }
+    }
+    
+    nodeCache.remove(zPath);
     childrenCache.remove(zPath);
-    statCache.remove(zPath);
   }
   
   public synchronized void clear() {
-    cache.clear();
+    for (NodeCache nc : nodeCache.values()) {
+      try {
+        nc.close();
+      } catch (IOException e) {
+        log.error(e, e);
+      }
+    }
+    for (PathChildrenCache pc : childrenCache.values()) {
+      try {
+        pc.close();
+      } catch (IOException e) {
+        log.error(e, e);
+      }
+    }
+    
+    nodeCache.clear();
     childrenCache.clear();
-    statCache.clear();
   }
   
   public synchronized void clear(String zPath) {
-    
-    for (Iterator<String> i = cache.keySet().iterator(); i.hasNext();) {
+    List<String> pathsToRemove = new ArrayList<String>();
+    for (Iterator<String> i = nodeCache.keySet().iterator(); i.hasNext();) {
       String path = i.next();
       if (path.startsWith(zPath))
-        i.remove();
+        pathsToRemove.add(path);
     }
     
     for (Iterator<String> i = childrenCache.keySet().iterator(); i.hasNext();) {
       String path = i.next();
       if (path.startsWith(zPath))
-        i.remove();
+        pathsToRemove.add(path);
     }
     
-    for (Iterator<String> i = statCache.keySet().iterator(); i.hasNext();) {
-      String path = i.next();
-      if (path.startsWith(zPath))
-        i.remove();
-    }
+    for (String path : pathsToRemove)
+      remove(path);
   }
   
   private static Map<String,ZooCache> instances = new HashMap<String,ZooCache>();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
index cb0d902..4587597 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooLock.java
@@ -20,8 +20,10 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.LockID;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
@@ -66,6 +68,10 @@ public class ZooLock implements Watcher {
   private boolean watchingParent = false;
   private String asyncLock;
   
+  public String toString() {
+    return path + ' ' + lock;
+  }
+  
   public ZooLock(String zookeepers, int timeInMillis, String scheme, byte[] auth, String path) {
     this(new ZooCache(zookeepers, timeInMillis), ZooReaderWriter.getInstance(zookeepers, timeInMillis, scheme, auth), path);
   }
@@ -380,21 +386,20 @@ public class ZooLock implements Watcher {
   
   public static boolean isLockHeld(ZooCache zc, LockID lid) {
     
-    List<String> children = zc.getChildren(lid.path);
+    List<ChildData> children = zc.getChildren(lid.path);
     
     if (children == null || children.size() == 0) {
       return false;
     }
     
-    children = new ArrayList<String>(children);
+    children = new ArrayList<ChildData>(children);
     Collections.sort(children);
     
-    String lockNode = children.get(0);
+    String lockNode = CuratorUtil.getNodeName(children.get(0));
     if (!lid.node.equals(lockNode))
       return false;
     
-    Stat stat = new Stat();
-    return zc.get(lid.path + "/" + lid.node, stat) != null && stat.getEphemeralOwner() == lid.eid;
+    return children.get(0).getStat().getEphemeralOwner() == lid.eid;
   }
   
   public static byte[] getLockData(ZooKeeper zk, String path) throws KeeperException, InterruptedException {
@@ -411,52 +416,43 @@ public class ZooLock implements Watcher {
     return zk.getData(path + "/" + lockNode, false, null);
   }
   
-  public static byte[] getLockData(org.apache.accumulo.fate.zookeeper.ZooCache zc, String path, Stat stat) {
+  public static ChildData getLockData(org.apache.accumulo.fate.zookeeper.ZooCache zc, String path) {
     
-    List<String> children = zc.getChildren(path);
+    List<ChildData> children = zc.getChildren(path);
     
     if (children == null || children.size() == 0) {
       return null;
     }
     
-    children = new ArrayList<String>(children);
+    children = new ArrayList<ChildData>(children);
     Collections.sort(children);
     
-    String lockNode = children.get(0);
+    String lockNode = CuratorUtil.getNodeName(children.get(0));
     
     if (!lockNode.startsWith(LOCK_PREFIX)) {
       throw new RuntimeException("Node " + lockNode + " at " + path + " is not a lock node");
     }
     
-    return zc.get(path + "/" + lockNode, stat);
+    return children.get(0);
   }
   
   private static ZooCache getLockDataZooCache;
   
-  public static byte[] getLockData(String path) {
-    return getLockData(path, null);
-  }
-  
-  public static byte[] getLockData(String path, Stat stat) {
-    return getLockData(getLockDataZooCache, path, stat);
+  public static ChildData getLockData(String path) {
+    return getLockData(getLockDataZooCache, path);
   }
   
   public static long getSessionId(ZooCache zc, String path) throws KeeperException, InterruptedException {
-    List<String> children = zc.getChildren(path);
+    List<ChildData> children = zc.getChildren(path);
     
     if (children == null || children.size() == 0) {
       return 0;
     }
     
-    children = new ArrayList<String>(children);
+    children = new ArrayList<ChildData>(children);
     Collections.sort(children);
     
-    String lockNode = children.get(0);
-    
-    Stat stat = new Stat();
-    if (zc.get(path + "/" + lockNode, stat) != null)
-      return stat.getEphemeralOwner();
-    return 0;
+    return children.get(0).getStat().getEphemeralOwner();
   }
   
   public long getSessionId() throws KeeperException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
index 5b856c0..9ad3402 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooUtil.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.accumulo.fate.util.UtilWaitThread;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.Code;
@@ -223,18 +224,16 @@ public class ZooUtil {
   
   public static byte[] getLockData(ZooCache zc, String path) {
     
-    List<String> children = zc.getChildren(path);
+    List<ChildData> children = zc.getChildren(path);
     
     if (children == null || children.size() == 0) {
       return null;
     }
     
-    children = new ArrayList<String>(children);
+    children = new ArrayList<ChildData>(children);
     Collections.sort(children);
     
-    String lockNode = children.get(0);
-    
-    return zc.get(path + "/" + lockNode);
+    return children.get(0).getData();
   }
   
   public static boolean isLockHeld(ZooKeeper zk, LockID lid) throws KeeperException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/minicluster/pom.xml
----------------------------------------------------------------------
diff --git a/minicluster/pom.xml b/minicluster/pom.xml
index aaa2c66..2553e4a 100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@ -46,6 +46,10 @@
       <artifactId>accumulo-start</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
       <scope>provided</scope>
@@ -66,11 +70,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4be0eaf..cb41543 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,14 +108,14 @@
   <properties>
     <!-- used for filtering the java source with the current version -->
     <accumulo.release.version>${project.version}</accumulo.release.version>
+    <!-- ZooKeeper 3.4.x works also, but we're not using new features yet; this ensures 3.3.x compatibility. -->
+    <curator.version>2.0.1-incubating</curator.version>
     <!-- the maven-release-plugin makes this recommendation, due to plugin bugs -->
     <maven.min-version>3.0.4</maven.min-version>
     <powermock.version>1.5</powermock.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <sealJars>false</sealJars>
-    <!-- ZooKeeper 3.4.x works also, but we're not using new features yet; this ensures 3.3.x compatibility. -->
-    <zookeeper.version>3.3.6</zookeeper.version>
   </properties>
   <dependencyManagement>
     <dependencies>
@@ -277,6 +277,16 @@
         <version>2.0</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.curator</groupId>
+        <artifactId>curator-framework</artifactId>
+        <version>${curator.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.curator</groupId>
+        <artifactId>curator-recipes</artifactId>
+        <version>${curator.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-client</artifactId>
         <version>${hadoop.version}</version>
@@ -302,11 +312,6 @@
         <version>0.9.0</version>
       </dependency>
       <dependency>
-        <groupId>org.apache.zookeeper</groupId>
-        <artifactId>zookeeper</artifactId>
-        <version>${zookeeper.version}</version>
-      </dependency>
-      <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>
         <version>3.1</version>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/proxy/pom.xml
----------------------------------------------------------------------
diff --git a/proxy/pom.xml b/proxy/pom.xml
index ce9e747..7679e89 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -90,8 +90,8 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 75447be..de9ce99 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -54,6 +54,10 @@
       <artifactId>accumulo-trace</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.thrift</groupId>
       <artifactId>libthrift</artifactId>
     </dependency>
@@ -98,11 +102,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <scope>provided</scope>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
index 074f3be..c9cc132 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
@@ -43,6 +43,7 @@ import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.zookeeper.ZooLock;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
@@ -84,15 +85,15 @@ public class HdfsZooInstance implements Instance {
     
     OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zoocache.");
     
-    byte[] loc = zooCache.get(zRootLocPath);
+    ChildData loc = zooCache.get(zRootLocPath);
     
-    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
+    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc.getData())) + " in %DURATION%");
     
     if (loc == null) {
       return null;
     }
     
-    return new String(loc).split("\\|")[0];
+    return new String(loc.getData()).split("\\|")[0];
   }
   
   @Override
@@ -102,7 +103,7 @@ public class HdfsZooInstance implements Instance {
     
     OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
     
-    byte[] loc = ZooLock.getLockData(zooCache, masterLocPath, null);
+    byte[] loc = ZooLock.getLockData(zooCache, masterLocPath).getData();
     
     opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
index 0a26b47..12e83da 100644
--- a/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
+++ b/server/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
@@ -31,8 +31,10 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.ConfigurationObserver;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 
 public class TableConfiguration extends AccumuloConfiguration {
@@ -118,10 +120,10 @@ public class TableConfiguration extends AccumuloConfiguration {
   
   private String get(String key) {
     String zPath = ZooUtil.getRoot(instanceId) + Constants.ZTABLES + "/" + table + Constants.ZTABLE_CONF + "/" + key;
-    byte[] v = getTablePropCache().get(zPath);
+    ChildData v = getTablePropCache().get(zPath);
     String value = null;
     if (v != null)
-      value = new String(v);
+      value = new String(v.getData());
     return value;
   }
   
@@ -132,12 +134,11 @@ public class TableConfiguration extends AccumuloConfiguration {
     for (Entry<String,String> parentEntry : parent)
       entries.put(parentEntry.getKey(), parentEntry.getValue());
     
-    List<String> children = getTablePropCache().getChildren(ZooUtil.getRoot(instanceId) + Constants.ZTABLES + "/" + table + Constants.ZTABLE_CONF);
+    String path = ZooUtil.getRoot(instanceId) + Constants.ZTABLES + "/" + table + Constants.ZTABLE_CONF;
+    List<ChildData> children = getTablePropCache().getChildren(path);
     if (children != null) {
-      for (String child : children) {
-        String value = get(child);
-        if (child != null && value != null)
-          entries.put(child, value);
+      for (ChildData child : children) {
+        entries.put(CuratorUtil.getNodeName(child), new String(child.getData()));
       }
     }
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
index d006498..d0c3ece 100644
--- a/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
+++ b/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
@@ -30,9 +30,11 @@ import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance.AccumuloNotInitializedException;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 
 public class ZooConfiguration extends AccumuloConfiguration {
@@ -53,6 +55,8 @@ public class ZooConfiguration extends AccumuloConfiguration {
       propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
       instance = new ZooConfiguration(parent);
       instanceId = inst.getInstanceID();
+      // Sets up a child cache listener for all properties
+      propCache.getChildKeys(ZooUtil.getRoot(instanceId) + Constants.ZCONFIG);
     }
     return instance;
   }
@@ -64,6 +68,8 @@ public class ZooConfiguration extends AccumuloConfiguration {
       @SuppressWarnings("deprecation")
       String deprecatedInstanceIdFromHdfs = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
       instanceId = deprecatedInstanceIdFromHdfs;
+      // Sets up a child cache listener for all properties
+      propCache.getChildKeys(ZooUtil.getRoot(instanceId) + Constants.ZCONFIG);
     }
     return instance;
   }
@@ -113,10 +119,10 @@ public class ZooConfiguration extends AccumuloConfiguration {
   
   private String get(String key) {
     String zPath = ZooUtil.getRoot(instanceId) + Constants.ZCONFIG + "/" + key;
-    byte[] v = propCache.get(zPath);
+    ChildData v = propCache.get(zPath);
     String value = null;
     if (v != null)
-      value = new String(v);
+      value = new String(v.getData());
     return value;
   }
   
@@ -127,12 +133,13 @@ public class ZooConfiguration extends AccumuloConfiguration {
     for (Entry<String,String> parentEntry : parent)
       entries.put(parentEntry.getKey(), parentEntry.getValue());
     
-    List<String> children = propCache.getChildren(ZooUtil.getRoot(instanceId) + Constants.ZCONFIG);
+    List<ChildData> children = propCache.getChildren(ZooUtil.getRoot(instanceId) + Constants.ZCONFIG);
     if (children != null) {
-      for (String child : children) {
-        String value = get(child);
-        if (child != null && value != null)
-          entries.put(child, value);
+      for (ChildData child : children) {
+        String node = CuratorUtil.getNodeName(child);
+        String value = get(node);
+        if (node != null && value != null)
+          entries.put(node, value);
       }
     }
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index bebff7f..85da665 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -45,6 +45,7 @@ import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
@@ -54,7 +55,6 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
 import org.apache.zookeeper.KeeperException.NotEmptyException;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.data.Stat;
 
 public class LiveTServerSet implements Watcher {
   
@@ -236,7 +236,7 @@ public class LiveTServerSet implements Watcher {
       final String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
       
       HashSet<String> all = new HashSet<String>(current.keySet());
-      all.addAll(getZooCache().getChildren(path));
+      all.addAll(getZooCache().getChildKeys(path));
       
       locklessServers.keySet().retainAll(all);
       
@@ -268,8 +268,7 @@ public class LiveTServerSet implements Watcher {
     TServerInfo info = current.get(server);
     
     final String lockPath = path + "/" + server;
-    Stat stat = new Stat();
-    byte[] lockData = ZooLock.getLockData(getZooCache(), lockPath, stat);
+    ChildData lockData = ZooLock.getLockData(getZooCache(), lockPath);
     
     if (lockData == null) {
       if (info != null) {
@@ -286,10 +285,10 @@ public class LiveTServerSet implements Watcher {
       }
     } else {
       locklessServers.remove(server);
-      ServerServices services = new ServerServices(new String(lockData));
+      ServerServices services = new ServerServices(new String(lockData.getData()));
       InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
       InetSocketAddress addr = AddressUtil.parseAddress(server);
-      TServerInstance instance = new TServerInstance(client, stat.getEphemeralOwner());
+      TServerInstance instance = new TServerInstance(client, lockData.getStat().getEphemeralOwner());
       
       if (info == null) {
         updates.add(instance);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/Master.java b/server/src/main/java/org/apache/accumulo/server/master/Master.java
index d7133a0..ed096c7 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -1302,8 +1302,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
           
           int[] counts = new int[TabletState.values().length];
           stats.begin();
-          // Walk through the tablets in our store, and work tablets
-          // towards their goal
+          // Walk through the tablets in our store, and work tablets towards their goal
           for (TabletLocationState tls : store) {
             if (tls == null) {
               continue;
@@ -2099,11 +2098,9 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     });
     
     TCredentials systemAuths = SecurityConstants.getSystemCredentials();
-    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
-        new MetaDataStateStore(instance, systemAuths, this)};
-    watchers.add(new TabletGroupWatcher(stores[2], null));
-    watchers.add(new TabletGroupWatcher(stores[1], watchers.get(0)));
-    watchers.add(new TabletGroupWatcher(stores[0], watchers.get(1)));
+    watchers.add(new TabletGroupWatcher(new MetaDataStateStore(instance, systemAuths, this), null));
+    watchers.add(new TabletGroupWatcher(new RootTabletStateStore(instance, systemAuths, this), watchers.get(0)));
+    watchers.add(new TabletGroupWatcher(new ZooTabletStateStore(new ZooStore(zroot)), watchers.get(1)));
     for (TabletGroupWatcher watcher : watchers) {
       watcher.start();
     }
@@ -2122,8 +2119,7 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     final long deadline = System.currentTimeMillis() + MAX_CLEANUP_WAIT_TIME;
     statusThread.join(remaining(deadline));
     
-    // quit, even if the tablet servers somehow jam up and the watchers
-    // don't stop
+    // quit, even if the tablet servers somehow jam up and the watchers don't stop
     for (TabletGroupWatcher watcher : watchers) {
       watcher.join(remaining(deadline));
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java b/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
index bce6681..6faeb1e 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/ZooStore.java
@@ -26,6 +26,7 @@ import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 
 public class ZooStore implements DistributedStore {
@@ -49,7 +50,10 @@ public class ZooStore implements DistributedStore {
   @Override
   public byte[] get(String path) throws DistributedStoreException {
     try {
-      return cache.get(relative(path));
+      ChildData cd = cache.get(relative(path));
+      if (cd != null)
+        return cd.getData();
+      return null;
     } catch (Exception ex) {
       throw new DistributedStoreException(ex);
     }
@@ -62,7 +66,7 @@ public class ZooStore implements DistributedStore {
   @Override
   public List<String> getChildren(String path) throws DistributedStoreException {
     try {
-      return cache.getChildren(relative(path));
+      return cache.getChildKeys(relative(path));
     } catch (Exception ex) {
       throw new DistributedStoreException(ex);
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java b/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
index fedbc96..6b3a3c0 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.curator.CuratorUtil;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -36,6 +37,7 @@ import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.util.TablePropUtil;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
@@ -151,20 +153,21 @@ public class TableManager {
   
   private void updateTableStateCache() {
     synchronized (tableStateCache) {
-      for (String tableId : zooStateCache.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES))
-        if (zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE) != null)
-          updateTableStateCache(tableId);
+      for (ChildData tableId : zooStateCache.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES))
+        if (zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + CuratorUtil.getNodeName(tableId) + Constants.ZTABLE_STATE) != null)
+          updateTableStateCache(CuratorUtil.getNodeName(tableId));
     }
   }
   
   public TableState updateTableStateCache(String tableId) {
     synchronized (tableStateCache) {
       TableState tState = TableState.UNKNOWN;
-      byte[] data = zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE);
+      byte[] data = zooStateCache.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE).getData();
       if (data != null) {
         String sState = new String(data);
         try {
           tState = TableState.valueOf(sState);
+          log.debug("updateTableStateCache reporting " + tableId + " with state " + tState + " based on " + new String(data));
         } catch (IllegalArgumentException e) {
           log.error("Unrecognized state for table with tableId=" + tableId + ": " + sState);
         }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
index 2a8e619..ff97e0f 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
@@ -141,7 +141,7 @@ public class SecurityOperation {
   
   public synchronized String getRootUsername() {
     if (rootUserName == null)
-      rootUserName = new String(zooCache.get(ZKUserPath));
+      rootUserName = new String(zooCache.get(ZKUserPath).getData());
     return rootUserName;
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
index 3ea1c88..80611fd 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
@@ -99,7 +99,7 @@ public final class ZKAuthenticator implements Authenticator {
   
   @Override
   public Set<String> listUsers() {
-    return new TreeSet<String>(zooCache.getChildren(ZKUserPath));
+    return new TreeSet<String>(zooCache.getChildKeys(ZKUserPath));
   }
   
   /**
@@ -189,13 +189,8 @@ public final class ZKAuthenticator implements Authenticator {
     PasswordToken pt = (PasswordToken) token;
     byte[] pass;
     String zpath = ZKUserPath + "/" + principal;
-    pass = zooCache.get(zpath);
+    pass = zooCache.get(zpath).getData();
     boolean result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
-    if (!result) {
-      zooCache.clear(zpath);
-      pass = zooCache.get(zpath);
-      result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
-    }
     return result;
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
index 89ed3b2..554aaf1 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
@@ -61,7 +61,7 @@ public class ZKAuthorizor implements Authorizor {
   }
   
   public Authorizations getCachedUserAuthorizations(String user) {
-    byte[] authsBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserAuths);
+    byte[] authsBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserAuths).getData();
     if (authsBytes != null)
       return ZKSecurityTool.convertAuthorizations(authsBytes);
     return Constants.NO_AUTHS;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
index ff5ab01..15f1c98 100644
--- a/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
+++ b/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
@@ -35,6 +35,7 @@ import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.zookeeper.ZooCache;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
+import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.Code;
@@ -108,9 +109,9 @@ public class ZKPermHandler implements PermissionHandler {
   
   @Override
   public boolean hasCachedTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
+    ChildData serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
     if (serializedPerms != null) {
-      return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
+      return ZKSecurityTool.convertTablePermissions(serializedPerms.getData()).contains(permission);
     }
     return false;
   }
@@ -118,12 +119,12 @@ public class ZKPermHandler implements PermissionHandler {
   @Override
   public void grantSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
     try {
-      byte[] permBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
+      ChildData permBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
       Set<SystemPermission> perms;
       if (permBytes == null) {
         perms = new TreeSet<SystemPermission>();
       } else {
-        perms = ZKSecurityTool.convertSystemPermissions(permBytes);
+        perms = ZKSecurityTool.convertSystemPermissions(permBytes.getData());
       }
       
       if (perms.add(permission)) {
@@ -145,9 +146,9 @@ public class ZKPermHandler implements PermissionHandler {
   @Override
   public void grantTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException {
     Set<TablePermission> tablePerms;
-    byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
+    ChildData serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
     if (serializedPerms != null)
-      tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
+      tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms.getData());
     else
       tablePerms = new TreeSet<TablePermission>();
     
@@ -171,13 +172,13 @@ public class ZKPermHandler implements PermissionHandler {
   
   @Override
   public void revokeSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    byte[] sysPermBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
+    ChildData sysPermBytes = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
     
     // User had no system permission, nothing to revoke.
     if (sysPermBytes == null)
       return;
     
-    Set<SystemPermission> sysPerms = ZKSecurityTool.convertSystemPermissions(sysPermBytes);
+    Set<SystemPermission> sysPerms = ZKSecurityTool.convertSystemPermissions(sysPermBytes.getData());
     
     try {
       if (sysPerms.remove(permission)) {
@@ -198,13 +199,13 @@ public class ZKPermHandler implements PermissionHandler {
   
   @Override
   public void revokeTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException {
-    byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
+    ChildData serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
     
     // User had no table permission, nothing to revoke.
     if (serializedPerms == null)
       return;
     
-    Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
+    Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms.getData());
     try {
       if (tablePerms.remove(permission)) {
         zooCache.clear();
@@ -230,7 +231,7 @@ public class ZKPermHandler implements PermissionHandler {
       synchronized (zooCache) {
         zooCache.clear();
         IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
-        for (String user : zooCache.getChildren(ZKUserPath))
+        for (String user : zooCache.getChildKeys(ZKUserPath))
           zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
       }
     } catch (KeeperException e) {
@@ -347,10 +348,10 @@ public class ZKPermHandler implements PermissionHandler {
   
   @Override
   public boolean hasCachedSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    byte[] perms = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
+    ChildData perms = zooCache.get(ZKUserPath + "/" + user + ZKUserSysPerms);
     if (perms == null)
       return false;
-    return ZKSecurityTool.convertSystemPermissions(perms).contains(permission);
+    return ZKSecurityTool.convertSystemPermissions(perms.getData()).contains(permission);
   }
   
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java b/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
index 64c5dd3..b83405d 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
@@ -140,7 +140,7 @@ public class ListInstances {
     try {
       String masterLocPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK;
       
-      byte[] master = ZooLock.getLockData(masterLocPath);
+      byte[] master = ZooLock.getLockData(masterLocPath).getData();
       if (master == null) {
         return null;
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java b/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
index aa5fe48..1dba361 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
@@ -92,9 +92,7 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
   private static final Text EMPTY_TEXT = new Text();
   private static Map<TCredentials,Writer> metadata_tables = new HashMap<TCredentials,Writer>();
   private static final Logger log = Logger.getLogger(MetadataTable.class);
-  
-  private static final int SAVE_ROOT_TABLET_RETRIES = 3;
-  
+    
   private MetadataTable() {
     
   }
@@ -319,22 +317,6 @@ public class MetadataTable extends org.apache.accumulo.core.util.MetadataTable {
     return results;
   }
   
-  public static boolean recordRootTabletLocation(String address) {
-    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
-    for (int i = 0; i < SAVE_ROOT_TABLET_RETRIES; i++) {
-      try {
-        log.info("trying to write root tablet location to ZooKeeper as " + address);
-        String zRootLocPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZROOT_TABLET_LOCATION;
-        zoo.putPersistentData(zRootLocPath, address.getBytes(), NodeExistsPolicy.OVERWRITE);
-        return true;
-      } catch (Exception e) {
-        log.error("Master: unable to save root tablet location in zookeeper. exception: " + e, e);
-      }
-    }
-    log.error("Giving up after " + SAVE_ROOT_TABLET_RETRIES + " retries");
-    return false;
-  }
-  
   public static SortedMap<String,DataFileValue> getDataFileSizes(KeyExtent extent, TCredentials credentials) {
     TreeMap<String,DataFileValue> sizes = new TreeMap<String,DataFileValue>();
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java b/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
index c3df185..dea12fb 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
@@ -51,7 +51,7 @@ public class TabletServerLocks {
       List<String> tabletServers = zoo.getChildren(tserverPath);
       
       for (String tabletServer : tabletServers) {
-        byte[] lockData = ZooLock.getLockData(tserverPath + "/" + tabletServer);
+        byte[] lockData = ZooLock.getLockData(tserverPath + "/" + tabletServer).getData();
         String holder = null;
         if (lockData != null) {
           holder = new String(lockData);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooCache.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooCache.java b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooCache.java
index bf34ef6..e9c4320 100644
--- a/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooCache.java
+++ b/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooCache.java
@@ -18,18 +18,14 @@ package org.apache.accumulo.server.zookeeper;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
-import org.apache.zookeeper.Watcher;
+import org.apache.accumulo.server.curator.CuratorUtil;
 
 public class ZooCache extends org.apache.accumulo.fate.zookeeper.ZooCache {
   public ZooCache() {
-    this(null);
+    super(CuratorUtil.getInstance());
   }
   
-  public ZooCache(Watcher watcher) {
-    super(ZooReaderWriter.getInstance(), watcher);
-  }
-  
-  public ZooCache(AccumuloConfiguration conf, Watcher watcher) {
-    super(conf.get(Property.INSTANCE_ZK_HOST), (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT), watcher);
+  public ZooCache(AccumuloConfiguration conf) {
+    super(conf.get(Property.INSTANCE_ZK_HOST), (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/test/pom.xml
----------------------------------------------------------------------
diff --git a/test/pom.xml b/test/pom.xml
index fe0ee8a..aa89737 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -58,6 +58,10 @@
       <artifactId>accumulo-trace</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.thrift</groupId>
       <artifactId>libthrift</artifactId>
     </dependency>
@@ -92,11 +96,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
index 83a1b4d..32555d5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java
@@ -50,16 +50,16 @@ public class CacheTestReader {
       Map<String,String> readData = new TreeMap<String,String>();
       
       for (int i = 0; i < numData; i++) {
-        byte[] v = zc.get(rootDir + "/data" + i);
+        byte[] v = zc.get(rootDir + "/data" + i).getData();
         if (v != null)
           readData.put(rootDir + "/data" + i, new String(v));
       }
       
-      byte[] v = zc.get(rootDir + "/dataS");
+      byte[] v = zc.get(rootDir + "/dataS").getData();
       if (v != null)
         readData.put(rootDir + "/dataS", new String(v));
       
-      List<String> children = zc.getChildren(rootDir + "/dir");
+      List<String> children = zc.getChildKeys(rootDir + "/dir");
       if (children != null)
         for (String child : children) {
           readData.put(rootDir + "/dir/" + child, "");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/518844b5/trace/pom.xml
----------------------------------------------------------------------
diff --git a/trace/pom.xml b/trace/pom.xml
index 9501f26..6ab1411 100644
--- a/trace/pom.xml
+++ b/trace/pom.xml
@@ -26,6 +26,10 @@
   <name>Trace</name>
   <dependencies>
     <dependency>
+      <groupId>org.apache.curator</groupId>
+      <artifactId>curator-framework</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.thrift</groupId>
       <artifactId>libthrift</artifactId>
     </dependency>
@@ -35,11 +39,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>


Mime
View raw message