From: Mahadev K. <ma...@ya...> - 2008-04-12 00:30:46
|
Hi Ted, Thanks for your email. I will get back with the response and updates to the documentation as soon as possible. For now, looking at your example it seems like you are trying to delete("/test") while it still has a child "/test/foobar"? The delete in zookeeper is not recursive. The keeper exception is actually notempty exception if you look in java/src/com/yahoo/zookeeper/KeeperException.java Please file a bug so that the exception printed is a little more informative. Regards Mahadev > -----Original Message----- > From: zoo...@li... [mailto:zookeeper-user- > bo...@li...] On Behalf Of Ted Dunning > Sent: Friday, April 11, 2008 4:53 PM > To: zoo...@li... > Subject: [Zookeeper-user] Problems with basics > > > Hi, > > First, congrats on a really clean, simple and apparently awesome system. > I > look forward to using it. > > I am trying to set up some of our systems to use zookeeper, but am having > some problems with very basic things. > > Here is a summary of grump causing things that I have gotten past: > > A) common ACL patterns appear to not be declared in a nice accessible way. > There are some things in ZooDefs, but they are hard to use due to deep > nesting of classes. > > B) the signature of create requires an ArrayList instead of a List. This > makes common idioms very verbose (unnecessarily so). > > C) the digest authentication scheme is not particularly well documented. > A > code sample would help. > > D) the examples don't explain the arguments to the constructor of > Zookeeper > are. Many examples omit some basic setup code which makes them hard to > replicate. > > > My major question is why the following toy program is saying this: > > com.yahoo.zookeeper.KeeperException: KeeperErrorCode = Unknown error -111 > at com.yahoo.zookeeper.ZooKeeper.delete(ZooKeeper.java:306) > at TestZooKeeper.delete(TestZooKeeper.java:44) > at TestZooKeeper.test1(TestZooKeeper.java:30) > > > Here is the code. All suggestions are welcome. > > public class TestZooKeeper extends TestCase { > static ZooKeeper zk; > private ArrayList<ACL> acl; > > public void test1() throws IOException, KeeperException, > InterruptedException { > zk = new ZooKeeper("ted-rh:8181", 30000, new LoggingWatcher()); > > assertTrue(exists("/")); > assertEquals("", get("/")); > if (exists("/test")) { > delete("/test"); > } > create("/test", ""); > assertTrue(exists("/test")); > > create("/test/foobar", "test data"); > > } > > private boolean exists(String path) throws KeeperException, > InterruptedException { > return zk.exists(path, false) != null; > } > > private void delete(String path) throws KeeperException, > InterruptedException { > zk.delete(path, -1); > } > > private String get(String path) throws KeeperException, > InterruptedException, UnsupportedEncodingException { > return new String(zk.getData(path, false, null), "UTF-8"); > } > > > private void create(String path, String content) throws > KeeperException, > InterruptedException, UnsupportedEncodingException { > acl = new ArrayList<ACL>(Collections.singletonList(new > ACL(ZooDefs.Perms.ALL, new Id("world", "anyone")))); > zk.create(path, content.getBytes("UTF-8"), acl, 0); > } > } > > > ------------------------------------------------------------------------ - > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/j av > aone > _______________________________________________ > Zookeeper-user mailing list > Zoo...@li... > https://lists.sourceforge.net/lists/listinfo/zookeeper-user |