Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change 
notification.

The following page has been changed by BenjaminReed:
http://wiki.apache.org/hadoop/ZooKeeper/ZooKeeperExercise1

------------------------------------------------------------------------------
  {{{
  import java.io.*;
  import org.apache.zookeeper.*;
+ import org.apache.zookeeper.data.*;
  
  public class SimpleZoo {
      static class MyWatcher implements Watcher {
@@ -27, +28 @@

  Lets create a program to create a znode (I'll use "/motd", but you can pick 
your own name). You'll need to add:
  
  {{{
-         zk.create("/motd", "hi".getBytes(), Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
+         zk.create("/motd", "hi".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
  }}}
  
  What happens if you try to create /motd twice?
@@ -35, +36 @@

  Create a new simple client to set "/motd":
  
  {{{
-         zk.setData("/motd", newdata, -1);
+         zk.setData("/motd", "new data".getBytes(), -1);
  }}}
  
  Create a new simple client to read "/motd".

Reply via email to