accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1483023 - in /accumulo/branches/1.5: ./ assemble/ core/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/org/apache/accumulo/fate/zookeeper/ proxy/ server/ server/src/main/java/org/apache/accumulo/server/util/ src/
Date Wed, 15 May 2013 19:24:02 GMT
Author: ecn
Date: Wed May 15 19:24:02 2013
New Revision: 1483023

URL: http://svn.apache.org/r1483023
Log:
ACCUMULO-1418 use ZooReaderWriter, and not raw ZooKeeper

Modified:
    accumulo/branches/1.5/   (props changed)
    accumulo/branches/1.5/assemble/   (props changed)
    accumulo/branches/1.5/core/   (props changed)
    accumulo/branches/1.5/examples/   (props changed)
    accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props
changed)
    accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
  (props changed)
    accumulo/branches/1.5/proxy/README   (props changed)
    accumulo/branches/1.5/server/   (props changed)
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
    accumulo/branches/1.5/src/   (props changed)

Propchange: accumulo/branches/1.5/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1482989
  Merged /accumulo/branches/1.4:r1482989

Propchange: accumulo/branches/1.5/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src/assemble:r1482989
  Merged /accumulo/branches/1.4/assemble:r1482989

Propchange: accumulo/branches/1.5/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/core:r1482989
  Merged /accumulo/branches/1.4/src/core:r1482989

Propchange: accumulo/branches/1.5/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src/examples:r1482989

Propchange: accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1482989
  Merged /accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1482989

Propchange: accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1482989
  Merged /accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1482989

Propchange: accumulo/branches/1.5/proxy/README
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/proxy/README:r1482989
  Merged /accumulo/branches/1.4/src/proxy/README:r1482989

Propchange: accumulo/branches/1.5/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/server:r1482989
  Merged /accumulo/branches/1.4/src/server:r1482989

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java?rev=1483023&r1=1483022&r2=1483023&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
(original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
Wed May 15 19:24:02 2013
@@ -24,15 +24,13 @@ import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
 import org.apache.accumulo.core.cli.Help;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
+import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -42,11 +40,11 @@ import com.beust.jcommander.Parameter;
 public class RestoreZookeeper {
   
   private static class Restore extends DefaultHandler {
-    ZooKeeper zk = null;
+    IZooReaderWriter zk = null;
     Stack<String> cwd = new Stack<String>();
     boolean overwrite = false;
     
-    Restore(ZooKeeper zk, boolean overwrite) {
+    Restore(IZooReaderWriter zk, boolean overwrite) {
       this.zk = zk;
       this.overwrite = overwrite;
     }
@@ -82,7 +80,7 @@ public class RestoreZookeeper {
         data = Base64.decodeBase64(value.getBytes());
       try {
         try {
-          ZooUtil.putPersistentData(zk, path, data, overwrite ? NodeExistsPolicy.OVERWRITE
: NodeExistsPolicy.FAIL);
+          zk.putPersistentData(path, data, overwrite ? NodeExistsPolicy.OVERWRITE : NodeExistsPolicy.FAIL);
         } catch (KeeperException e) {
           if (e.code().equals(KeeperException.Code.NODEEXISTS))
             throw new RuntimeException(path + " exists.  Remove it first.");
@@ -112,19 +110,14 @@ public class RestoreZookeeper {
     Opts opts = new Opts();
     opts.parseArgs(RestoreZookeeper.class.getName(), args);
     
-    int timeout = 30 * 1000;
     InputStream in = System.in;
     if (opts.file != null) {
       in = new FileInputStream(opts.file);
     }
-    ZooKeeper zk = new ZooKeeper(opts.keepers, timeout, new Watcher() {
-      @Override
-      public void process(WatchedEvent event) {}
-    });
     
     SAXParserFactory factory = SAXParserFactory.newInstance();
     SAXParser parser = factory.newSAXParser();
-    parser.parse(in, new Restore(zk, opts.overwrite));
+    parser.parse(in, new Restore(ZooReaderWriter.getInstance(), opts.overwrite));
     in.close();
   }
 }

Propchange: accumulo/branches/1.5/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1482989
  Merged /accumulo/branches/1.4/src/src:r1482989



Mime
View raw message