You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2018/07/04 11:02:29 UTC

[01/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Repository: zookeeper
Updated Branches:
  refs/heads/master 3465e0ced -> 4607a3e15


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperTutorial.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperTutorial.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperTutorial.xml
new file mode 100644
index 0000000..e320ed6
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperTutorial.xml
@@ -0,0 +1,712 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="ar_Tutorial">
+  <title>Programming with ZooKeeper - A basic tutorial</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This article contains sample Java code for simple implementations of barrier
+      and consumers queues..</para>
+
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_Introduction">
+    <title>Introduction</title>
+
+    <para>In this tutorial, we show simple implementations of barriers and 
+    producer-consumer queues using ZooKeeper. We call the respective classes Barrier and Queue. 
+    These examples assume that you have at least one ZooKeeper server running.</para>
+    
+    <para>Both primitives use the following common excerpt of code:</para>
+    
+    <programlisting>
+    static ZooKeeper zk = null;
+    static Integer mutex;
+
+    String root;
+
+    SyncPrimitive(String address) {
+        if(zk == null){
+            try {
+                System.out.println("Starting ZK:");
+                zk = new ZooKeeper(address, 3000, this);
+                mutex = new Integer(-1);
+                System.out.println("Finished starting ZK: " + zk);
+            } catch (IOException e) {
+                System.out.println(e.toString());
+                zk = null;
+            }
+        }
+    }
+
+    synchronized public void process(WatchedEvent event) {
+        synchronized (mutex) {
+            mutex.notify();
+        }
+    }
+</programlisting>
+
+<para>Both classes extend SyncPrimitive. In this way, we execute steps that are 
+common to all primitives in the constructor of SyncPrimitive. To keep the examples 
+simple, we create a ZooKeeper object the first time we instantiate either a barrier 
+object or a queue object, and we declare a static variable that is a reference 
+to this object. The subsequent instances of Barrier and Queue check whether a 
+ZooKeeper object exists. Alternatively, we could have the application creating a
+ZooKeeper object and passing it to the constructor of Barrier and Queue.</para>
+<para>
+We use the process() method to process notifications triggered due to watches. 
+In the following discussion, we present code that sets watches. A watch is internal 
+structure that enables ZooKeeper to notify a client of a change to a node. For example, 
+if a client is waiting for other clients to leave a barrier, then it can set a watch and 
+wait for modifications to a particular node, which can indicate that it is the end of the wait. 
+This point becomes clear once we go over the examples.
+</para>
+</section>
+   
+ <section id="sc_barriers"><title>Barriers</title>
+ 
+ <para>
+ A barrier is a primitive that enables a group of processes to synchronize the 
+ beginning and the end of a computation. The general idea of this implementation 
+ is to have a barrier node that serves the purpose of being a parent for individual 
+ process nodes. Suppose that we call the barrier node "/b1". Each process "p" then 
+ creates a node "/b1/p". Once enough processes have created their corresponding 
+ nodes, joined processes can start the computation.
+ </para>
+ 
+ <para>In this example, each process instantiates a Barrier object, and its constructor takes as parameters:</para>
+
+ <itemizedlist><listitem><para>the address of a ZooKeeper server (e.g., "zoo1.foo.com:2181")</para></listitem>
+<listitem><para>the path of the barrier node on ZooKeeper (e.g., "/b1")</para></listitem>
+<listitem><para>the size of the group of processes</para></listitem>
+</itemizedlist>
+
+<para>The constructor of Barrier passes the address of the Zookeeper server to the 
+constructor of the parent class. The parent class creates a ZooKeeper instance if 
+one does not exist. The constructor of Barrier then creates a 
+barrier node on ZooKeeper, which is the parent node of all process nodes, and 
+we call root (<emphasis role="bold">Note:</emphasis> This is not the ZooKeeper root "/").</para>
+
+<programlisting>
+        /**
+         * Barrier constructor
+         *
+         * @param address
+         * @param root
+         * @param size
+         */
+        Barrier(String address, String root, int size) {
+            super(address);
+            this.root = root;
+            this.size = size;
+
+            // Create barrier node
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println("Keeper exception when instantiating queue: "
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println("Interrupted exception");
+                }
+            }
+
+            // My node name
+            try {
+                name = new String(InetAddress.getLocalHost().getCanonicalHostName().toString());
+            } catch (UnknownHostException e) {
+                System.out.println(e.toString());
+            }
+
+        }
+</programlisting>
+<para>
+To enter the barrier, a process calls enter(). The process creates a node under 
+the root to represent it, using its host name to form the node name. It then wait 
+until enough processes have entered the barrier. A process does it by checking 
+the number of children the root node has with "getChildren()", and waiting for 
+notifications in the case it does not have enough. To receive a notification when 
+there is a change to the root node, a process has to set a watch, and does it 
+through the call to "getChildren()". In the code, we have that "getChildren()" 
+has two parameters. The first one states the node to read from, and the second is
+a boolean flag that enables the process to set a watch. In the code the flag is true.
+</para>
+
+<programlisting>
+        /**
+         * Join barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+
+        boolean enter() throws KeeperException, InterruptedException{
+            zk.create(root + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                    CreateMode.EPHEMERAL_SEQUENTIAL);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+
+                    if (list.size() &lt; size) {
+                        mutex.wait();
+                    } else {
+                        return true;
+                    }
+                }
+            }
+        }
+</programlisting>
+<para>
+Note that enter() throws both KeeperException and InterruptedException, so it is 
+the responsibility of the application to catch and handle such exceptions.</para>
+
+<para>
+Once the computation is finished, a process calls leave() to leave the barrier. 
+First it deletes its corresponding node, and then it gets the children of the root 
+node. If there is at least one child, then it waits for a notification (obs: note 
+that the second parameter of the call to getChildren() is true, meaning that 
+ZooKeeper has to set a watch on the the root node). Upon reception of a notification, 
+it checks once more whether the root node has any children.</para>
+
+<programlisting>
+        /**
+         * Wait until all reach barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+
+        boolean leave() throws KeeperException, InterruptedException{
+            zk.delete(root + "/" + name, 0);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                        if (list.size() &gt; 0) {
+                            mutex.wait();
+                        } else {
+                            return true;
+                        }
+                    }
+                }
+        }
+    }
+</programlisting>
+</section>
+<section id="sc_producerConsumerQueues"><title>Producer-Consumer Queues</title>
+<para>
+A producer-consumer queue is a distributed data structure that groups of processes 
+use to generate and consume items. Producer processes create new elements and add 
+them to the queue. Consumer processes remove elements from the list, and process them. 
+In this implementation, the elements are simple integers. The queue is represented 
+by a root node, and to add an element to the queue, a producer process creates a new node, 
+a child of the root node.
+</para>
+
+<para>
+The following excerpt of code corresponds to the constructor of the object. As 
+with Barrier objects, it first calls the constructor of the parent class, SyncPrimitive, 
+that creates a ZooKeeper object if one doesn't exist. It then verifies if the root 
+node of the queue exists, and creates if it doesn't.
+</para>
+<programlisting>
+        /**
+         * Constructor of producer-consumer queue
+         *
+         * @param address
+         * @param name
+         */
+        Queue(String address, String name) {
+            super(address);
+            this.root = name;
+            // Create ZK node name
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println("Keeper exception when instantiating queue: "
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println("Interrupted exception");
+                }
+            }
+        }
+</programlisting>
+ 
+<para>
+A producer process calls "produce()" to add an element to the queue, and passes 
+an integer as an argument. To add an element to the queue, the method creates a 
+new node using "create()", and uses the SEQUENCE flag to instruct ZooKeeper to 
+append the value of the sequencer counter associated to the root node. In this way, 
+we impose a total order on the elements of the queue, thus guaranteeing that the 
+oldest element of the queue is the next one consumed.
+</para>
+
+<programlisting>
+        /**
+         * Add element to the queue.
+         *
+         * @param i
+         * @return
+         */
+
+        boolean produce(int i) throws KeeperException, InterruptedException{
+            ByteBuffer b = ByteBuffer.allocate(4);
+            byte[] value;
+
+            // Add child with value i
+            b.putInt(i);
+            value = b.array();
+            zk.create(root + "/element", value, Ids.OPEN_ACL_UNSAFE,
+                        CreateMode.PERSISTENT_SEQUENTIAL);
+
+            return true;
+        }
+</programlisting>
+<para>
+To consume an element, a consumer process obtains the children of the root node, 
+reads the node with smallest counter value, and returns the element. Note that 
+if there is a conflict, then one of the two contending processes won't be able to 
+delete the node and the delete operation will throw an exception.</para>
+
+<para>
+A call to getChildren() returns the list of children in lexicographic order. 
+As lexicographic order does not necessary follow the numerical order of the counter 
+values, we need to decide which element is the smallest. To decide which one has 
+the smallest counter value, we traverse the list, and remove the prefix "element" 
+from each one.</para>
+
+<programlisting>
+        /**
+         * Remove first element from the queue.
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+        int consume() throws KeeperException, InterruptedException{
+            int retvalue = -1;
+            Stat stat = null;
+
+            // Get the first element available
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                    if (list.size() == 0) {
+                        System.out.println("Going to wait");
+                        mutex.wait();
+                    } else {
+                        Integer min = new Integer(list.get(0).substring(7));
+                        for(String s : list){
+                            Integer tempValue = new Integer(s.substring(7));
+                            //System.out.println("Temporary value: " + tempValue);
+                            if(tempValue &lt; min) min = tempValue;
+                        }
+                        System.out.println("Temporary value: " + root + "/element" + min);
+                        byte[] b = zk.getData(root + "/element" + min,
+                                    false, stat);
+                        zk.delete(root + "/element" + min, 0);
+                        ByteBuffer buffer = ByteBuffer.wrap(b);
+                        retvalue = buffer.getInt();
+
+                        return retvalue;
+                    }
+                }
+            }
+        }
+    }
+</programlisting>
+ 
+</section>
+
+<section>
+<title>Complete example</title>
+<para>
+In the following section you can find a complete command line application to demonstrate the above mentioned
+recipes. Use the following command to run it.
+</para>
+<programlisting>
+ZOOBINDIR="[path_to_distro]/bin"
+. "$ZOOBINDIR"/zkEnv.sh
+java SyncPrimitive [Test Type] [ZK server] [No of elements] [Client type]
+</programlisting>
+
+<section>
+<title>Queue test</title>
+<para>Start a producer to create 100 elements</para>
+<programlisting>
+java SyncPrimitive qTest localhost 100 p
+</programlisting>
+
+<para>Start a consumer to consume 100 elements</para>
+<programlisting>
+java SyncPrimitive qTest localhost 100 c
+</programlisting>
+</section>
+
+<section>
+<title>Barrier test</title>
+<para>Start a barrier with 2 participants (start as many times as many participants you'd like to enter)</para>
+<programlisting>
+java SyncPrimitive bTest localhost 2
+</programlisting>
+</section>
+
+<section id="sc_sourceListing"><title>Source Listing</title>
+<example id="eg_SyncPrimitive_java">
+<title>SyncPrimitive.Java</title>
+<programlisting>
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+
+public class SyncPrimitive implements Watcher {
+
+    static ZooKeeper zk = null;
+    static Integer mutex;
+
+    String root;
+
+    SyncPrimitive(String address) {
+        if(zk == null){
+            try {
+                System.out.println("Starting ZK:");
+                zk = new ZooKeeper(address, 3000, this);
+                mutex = new Integer(-1);
+                System.out.println("Finished starting ZK: " + zk);
+            } catch (IOException e) {
+                System.out.println(e.toString());
+                zk = null;
+            }
+        }
+        //else mutex = new Integer(-1);
+    }
+
+    synchronized public void process(WatchedEvent event) {
+        synchronized (mutex) {
+            //System.out.println("Process: " + event.getType());
+            mutex.notify();
+        }
+    }
+
+    /**
+     * Barrier
+     */
+    static public class Barrier extends SyncPrimitive {
+        int size;
+        String name;
+
+        /**
+         * Barrier constructor
+         *
+         * @param address
+         * @param root
+         * @param size
+         */
+        Barrier(String address, String root, int size) {
+            super(address);
+            this.root = root;
+            this.size = size;
+
+            // Create barrier node
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println("Keeper exception when instantiating queue: "
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println("Interrupted exception");
+                }
+            }
+
+            // My node name
+            try {
+                name = new String(InetAddress.getLocalHost().getCanonicalHostName().toString());
+            } catch (UnknownHostException e) {
+                System.out.println(e.toString());
+            }
+
+        }
+
+        /**
+         * Join barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+
+        boolean enter() throws KeeperException, InterruptedException{
+            zk.create(root + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                    CreateMode.EPHEMERAL_SEQUENTIAL);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+
+                    if (list.size() &lt; size) {
+                        mutex.wait();
+                    } else {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        /**
+         * Wait until all reach barrier
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+
+        boolean leave() throws KeeperException, InterruptedException{
+            zk.delete(root + "/" + name, 0);
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                        if (list.size() &gt; 0) {
+                            mutex.wait();
+                        } else {
+                            return true;
+                        }
+                    }
+                }
+        }
+    }
+
+    /**
+     * Producer-Consumer queue
+     */
+    static public class Queue extends SyncPrimitive {
+
+        /**
+         * Constructor of producer-consumer queue
+         *
+         * @param address
+         * @param name
+         */
+        Queue(String address, String name) {
+            super(address);
+            this.root = name;
+            // Create ZK node name
+            if (zk != null) {
+                try {
+                    Stat s = zk.exists(root, false);
+                    if (s == null) {
+                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
+                                CreateMode.PERSISTENT);
+                    }
+                } catch (KeeperException e) {
+                    System.out
+                            .println("Keeper exception when instantiating queue: "
+                                    + e.toString());
+                } catch (InterruptedException e) {
+                    System.out.println("Interrupted exception");
+                }
+            }
+        }
+
+        /**
+         * Add element to the queue.
+         *
+         * @param i
+         * @return
+         */
+
+        boolean produce(int i) throws KeeperException, InterruptedException{
+            ByteBuffer b = ByteBuffer.allocate(4);
+            byte[] value;
+
+            // Add child with value i
+            b.putInt(i);
+            value = b.array();
+            zk.create(root + "/element", value, Ids.OPEN_ACL_UNSAFE,
+                        CreateMode.PERSISTENT_SEQUENTIAL);
+
+            return true;
+        }
+
+
+        /**
+         * Remove first element from the queue.
+         *
+         * @return
+         * @throws KeeperException
+         * @throws InterruptedException
+         */
+        int consume() throws KeeperException, InterruptedException{
+            int retvalue = -1;
+            Stat stat = null;
+
+            // Get the first element available
+            while (true) {
+                synchronized (mutex) {
+                    List&lt;String&gt; list = zk.getChildren(root, true);
+                    if (list.size() == 0) {
+                        System.out.println("Going to wait");
+                        mutex.wait();
+                    } else {
+                        Integer min = new Integer(list.get(0).substring(7));
+                        String minNode = list.get(0);
+                        for(String s : list){
+                            Integer tempValue = new Integer(s.substring(7));
+                            //System.out.println("Temporary value: " + tempValue);
+                            if(tempValue &lt; min) {
+                                min = tempValue;
+                                minNode = s;
+                            }
+                        }
+                        System.out.println("Temporary value: " + root + "/" + minNode);
+                        byte[] b = zk.getData(root + "/" + minNode,
+                        false, stat);
+                        zk.delete(root + "/" + minNode, 0);
+                        ByteBuffer buffer = ByteBuffer.wrap(b);
+                        retvalue = buffer.getInt();
+
+                        return retvalue;
+                    }
+                }
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+        if (args[0].equals("qTest"))
+            queueTest(args);
+        else
+            barrierTest(args);
+
+    }
+
+    public static void queueTest(String args[]) {
+        Queue q = new Queue(args[1], "/app1");
+
+        System.out.println("Input: " + args[1]);
+        int i;
+        Integer max = new Integer(args[2]);
+
+        if (args[3].equals("p")) {
+            System.out.println("Producer");
+            for (i = 0; i &lt; max; i++)
+                try{
+                    q.produce(10 + i);
+                } catch (KeeperException e){
+
+                } catch (InterruptedException e){
+
+                }
+        } else {
+            System.out.println("Consumer");
+
+            for (i = 0; i &lt; max; i++) {
+                try{
+                    int r = q.consume();
+                    System.out.println("Item: " + r);
+                } catch (KeeperException e){
+                    i--;
+                } catch (InterruptedException e){
+
+                }
+            }
+        }
+    }
+
+    public static void barrierTest(String args[]) {
+        Barrier b = new Barrier(args[1], "/b1", new Integer(args[2]));
+        try{
+            boolean flag = b.enter();
+            System.out.println("Entered barrier: " + args[2]);
+            if(!flag) System.out.println("Error when entering the barrier");
+        } catch (KeeperException e){
+
+        } catch (InterruptedException e){
+
+        }
+
+        // Generate random integer
+        Random rand = new Random();
+        int r = rand.nextInt(100);
+        // Loop for rand iterations
+        for (int i = 0; i &lt; r; i++) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+
+            }
+        }
+        try{
+            b.leave();
+        } catch (KeeperException e){
+
+        } catch (InterruptedException e){
+
+        }
+        System.out.println("Left barrier");
+    }
+}
+</programlisting></example>
+</section>
+</section>
+
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/2pc.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/2pc.jpg b/zookeeper-docs/src/documentation/resources/images/2pc.jpg
new file mode 100755
index 0000000..fe4488f
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/2pc.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/bk-overview.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/bk-overview.jpg b/zookeeper-docs/src/documentation/resources/images/bk-overview.jpg
new file mode 100644
index 0000000..6e12fb4
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/bk-overview.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/favicon.ico
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/favicon.ico b/zookeeper-docs/src/documentation/resources/images/favicon.ico
new file mode 100644
index 0000000..161bcf7
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/favicon.ico differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/hadoop-logo.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/hadoop-logo.jpg b/zookeeper-docs/src/documentation/resources/images/hadoop-logo.jpg
new file mode 100644
index 0000000..809525d
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/hadoop-logo.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/state_dia.dia
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/state_dia.dia b/zookeeper-docs/src/documentation/resources/images/state_dia.dia
new file mode 100755
index 0000000..4a58a00
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/state_dia.dia differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/state_dia.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/state_dia.jpg b/zookeeper-docs/src/documentation/resources/images/state_dia.jpg
new file mode 100755
index 0000000..b6f4a8b
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/state_dia.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkarch.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkarch.jpg b/zookeeper-docs/src/documentation/resources/images/zkarch.jpg
new file mode 100644
index 0000000..a0e5fcc
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkarch.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkcomponents.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkcomponents.jpg b/zookeeper-docs/src/documentation/resources/images/zkcomponents.jpg
new file mode 100644
index 0000000..7690578
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkcomponents.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zknamespace.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zknamespace.jpg b/zookeeper-docs/src/documentation/resources/images/zknamespace.jpg
new file mode 100644
index 0000000..05534bc
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zknamespace.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkperfRW-3.2.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkperfRW-3.2.jpg b/zookeeper-docs/src/documentation/resources/images/zkperfRW-3.2.jpg
new file mode 100644
index 0000000..594b50b
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkperfRW-3.2.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkperfRW.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkperfRW.jpg b/zookeeper-docs/src/documentation/resources/images/zkperfRW.jpg
new file mode 100644
index 0000000..ad3019f
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkperfRW.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkperfreliability.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkperfreliability.jpg b/zookeeper-docs/src/documentation/resources/images/zkperfreliability.jpg
new file mode 100644
index 0000000..232bba8
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkperfreliability.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zkservice.jpg
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zkservice.jpg b/zookeeper-docs/src/documentation/resources/images/zkservice.jpg
new file mode 100644
index 0000000..1ec9154
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zkservice.jpg differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/resources/images/zookeeper_small.gif
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/resources/images/zookeeper_small.gif b/zookeeper-docs/src/documentation/resources/images/zookeeper_small.gif
new file mode 100644
index 0000000..4e8014f
Binary files /dev/null and b/zookeeper-docs/src/documentation/resources/images/zookeeper_small.gif differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/skinconf.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/skinconf.xml b/zookeeper-docs/src/documentation/skinconf.xml
new file mode 100644
index 0000000..9edf69e
--- /dev/null
+++ b/zookeeper-docs/src/documentation/skinconf.xml
@@ -0,0 +1,360 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!--
+Skin configuration file. This file contains details of your project,
+which will be used to configure the chosen Forrest skin.
+-->
+
+<!DOCTYPE skinconfig PUBLIC "-//APACHE//DTD Skin Configuration V0.6-3//EN" "http://forrest.apache.org/dtd/skinconfig-v06-3.dtd">
+<skinconfig>
+  <!-- To enable lucene search add provider="lucene" (default is google).
+    Add box-location="alt" to move the search box to an alternate location
+    (if the skin supports it) and box-location="all" to show it in all
+    available locations on the page.  Remove the <search> element to show
+    no search box. @domain will enable sitesearch for the specific domain with google.
+    In other words google will search the @domain for the query string.
+
+  -->
+  <search name="ZooKeeper" domain="zookeeper.apache.org" provider="google"/>
+
+  <!-- Disable the print link? If enabled, invalid HTML 4.0.1 -->
+  <disable-print-link>true</disable-print-link>  
+  <!-- Disable the PDF link? -->
+  <disable-pdf-link>false</disable-pdf-link>
+  <!-- Disable the POD link? -->
+  <disable-pod-link>true</disable-pod-link>
+  <!-- Disable the Text link? FIXME: NOT YET IMPLEMENETED. -->
+  <disable-txt-link>true</disable-txt-link>
+  <!-- Disable the xml source link? -->
+  <!-- The xml source link makes it possible to access the xml rendition
+    of the source frim the html page, and to have it generated statically.
+    This can be used to enable other sites and services to reuse the
+    xml format for their uses. Keep this disabled if you don't want other
+    sites to easily reuse your pages.-->
+  <disable-xml-link>true</disable-xml-link>
+
+  <!-- Disable navigation icons on all external links? -->
+  <disable-external-link-image>true</disable-external-link-image>
+
+  <!-- Disable w3c compliance links? 
+    Use e.g. align="center" to move the compliance links logos to 
+    an alternate location default is left.
+    (if the skin supports it) -->
+  <disable-compliance-links>true</disable-compliance-links>
+
+  <!-- Render mailto: links unrecognisable by spam harvesters? -->
+  <obfuscate-mail-links>false</obfuscate-mail-links>
+
+  <!-- Disable the javascript facility to change the font size -->
+  <disable-font-script>true</disable-font-script>
+
+  <!-- project logo -->
+  <project-name>ZooKeeper</project-name>
+  <project-description>ZooKeeper: distributed coordination</project-description>
+  <project-url>http://zookeeper.apache.org/</project-url>
+  <project-logo>images/zookeeper_small.gif</project-logo>
+
+  <!-- group logo -->
+  <group-name>Hadoop</group-name>
+  <group-description>Apache Hadoop</group-description>
+  <group-url>http://hadoop.apache.org/</group-url>
+  <group-logo>images/hadoop-logo.jpg</group-logo>
+
+  <!-- optional host logo (e.g. sourceforge logo)
+       default skin: renders it at the bottom-left corner -->
+  <host-url></host-url>
+  <host-logo></host-logo>
+
+  <!-- relative url of a favicon file, normally favicon.ico -->
+  <favicon-url>images/favicon.ico</favicon-url>
+
+  <!-- The following are used to construct a copyright statement -->
+  <year></year>
+  <vendor>The Apache Software Foundation.</vendor>
+  <copyright-link>http://www.apache.org/licenses/</copyright-link>
+
+  <!-- Some skins use this to form a 'breadcrumb trail' of links.
+    Use location="alt" to move the trail to an alternate location
+    (if the skin supports it).
+	  Omit the location attribute to display the trail in the default location.
+	  Use location="none" to not display the trail (if the skin supports it).
+    For some skins just set the attributes to blank.
+  -->
+  <trail>
+    <link1 name="Apache" href="http://www.apache.org/"/>
+    <link2 name="ZooKeeper" href="http://zookeeper.apache.org/"/>
+    <link3 name="ZooKeeper" href="http://zookeeper.apache.org/"/>
+  </trail>
+
+  <!-- Configure the TOC, i.e. the Table of Contents.
+  @max-depth
+   how many "section" levels need to be included in the
+   generated Table of Contents (TOC). 
+  @min-sections
+   Minimum required to create a TOC.
+  @location ("page","menu","page,menu", "none")
+   Where to show the TOC.
+  -->
+  <toc max-depth="2" min-sections="1" location="page"/>
+
+  <!-- Heading types can be clean|underlined|boxed  -->
+  <headings type="clean"/>
+  
+  <!-- The optional feedback element will be used to construct a
+    feedback link in the footer with the page pathname appended:
+    <a href="@href">{@to}</a>
+  <feedback to="webmaster@foo.com"
+    href="mailto:webmaster@foo.com?subject=Feedback&#160;" >
+    Send feedback about the website to:
+  </feedback>
+    -->
+  <!--
+    extra-css - here you can define custom css-elements that are 
+    a. overriding the fallback elements or 
+    b. adding the css definition from new elements that you may have 
+       used in your documentation.
+    -->
+  <extra-css>
+    <!--Example of b. 
+        To define the css definition of a new element that you may have used
+        in the class attribute of a <p> node. 
+        e.g. <p class="quote"/>
+    -->
+    p.quote {
+      margin-left: 2em;
+      padding: .5em;
+      background-color: #f0f0f0;
+      font-family: monospace;
+    }
+
+    pre.code {
+      margin-left: 0em;
+      padding: 0.5em;
+      background-color: #f0f0f0;
+      font-family: monospace;
+    }
+
+<!-- patricks
+    .code {
+      font-family: "Courier New", Courier, monospace;
+      font-size: 110%;
+    }
+-->
+
+  </extra-css>
+
+  <colors>
+  <!-- These values are used for the generated CSS files. -->
+
+  <!-- Krysalis -->
+<!--
+    <color name="header"    value="#FFFFFF"/>
+
+    <color name="tab-selected" value="#a5b6c6" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="tab-unselected" value="#F7F7F7"  link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-selected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
+
+    <color name="heading" value="#a5b6c6"/>
+    <color name="subheading" value="#CFDCED"/>
+        
+    <color name="navstrip" value="#CFDCED" font="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="toolbox" value="#a5b6c6"/>
+    <color name="border" value="#a5b6c6"/>
+        
+    <color name="menu" value="#F7F7F7" link="#000000" vlink="#000000" hlink="#000000"/>    
+    <color name="dialog" value="#F7F7F7"/>
+            
+    <color name="body"    value="#ffffff" link="#0F3660" vlink="#009999" hlink="#000066"/>
+    
+    <color name="table" value="#a5b6c6"/>    
+    <color name="table-cell" value="#ffffff"/>    
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#a5b6c6"/>
+        
+    <color name="footer" value="#a5b6c6"/>
+-->
+  
+  <!-- Forrest -->
+<!--
+    <color name="header"    value="#294563"/>
+
+    <color name="tab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="tab-unselected" value="#b5c7e7" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="subtab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="subtab-unselected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+
+    <color name="heading" value="#294563"/>
+    <color name="subheading" value="#4a6d8c"/>
+        
+    <color name="navstrip" value="#cedfef" font="#0F3660" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="toolbox" value="#4a6d8c"/>
+    <color name="border" value="#294563"/>
+    
+    <color name="menu" value="#4a6d8c" font="#cedfef" link="#ffffff" vlink="#ffffff" hlink="#ffcf00"/>    
+    <color name="dialog" value="#4a6d8c"/>
+            
+    <color name="body" value="#ffffff"  link="#0F3660" vlink="#009999" hlink="#000066"/>
+    
+    <color name="table" value="#7099C5"/>    
+    <color name="table-cell" value="#f0f0ff"/>    
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#CFDCED"/>
+        
+    <color name="footer" value="#cedfef"/>
+-->
+
+  <!-- Collabnet --> 
+<!--
+    <color name="header"    value="#003366"/>
+
+    <color name="tab-selected" value="#dddddd" link="#555555" vlink="#555555" hlink="#555555"/>
+    <color name="tab-unselected" value="#999999" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="subtab-selected" value="#cccccc" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#cccccc" link="#555555" vlink="#555555" hlink="#555555"/>
+
+    <color name="heading" value="#003366"/>
+    <color name="subheading" value="#888888"/>
+    
+    <color name="navstrip" value="#dddddd" font="#555555"/>
+    <color name="toolbox" value="#dddddd" font="#555555"/>
+    <color name="border" value="#999999"/>
+    
+    <color name="menu" value="#ffffff"/>    
+    <color name="dialog" value="#eeeeee"/>
+            
+    <color name="body"      value="#ffffff"/>
+    
+    <color name="table" value="#ccc"/>    
+    <color name="table-cell" value="#ffffff"/>   
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#003366"/>
+        
+    <color name="footer" value="#ffffff"/>
+-->
+ <!-- Lenya using pelt-->
+<!--
+    <color name="header" value="#ffffff"/>
+
+    <color name="tab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="tab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-selected" value="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+
+    <color name="heading" value="#E5E4D9"/>
+    <color name="subheading" value="#000000"/>
+    <color name="published" value="#4C6C8F" font="#FFFFFF"/>
+    <color name="feedback" value="#4C6C8F" font="#FFFFFF" align="center"/>
+    <color name="navstrip" value="#E5E4D9" font="#000000"/>
+
+    <color name="toolbox" value="#CFDCED" font="#000000"/>
+
+    <color name="border" value="#999999"/>
+    <color name="menu" value="#4C6C8F" font="#ffffff" link="#ffffff" vlink="#ffffff" hlink="#ffffff" current="#FFCC33" />    
+    <color name="menuheading" value="#cfdced" font="#000000" />
+    <color name="searchbox" value="#E5E4D9" font="#000000"/>
+    
+    <color name="dialog" value="#CFDCED"/>
+    <color name="body" value="#ffffff" />            
+    
+    <color name="table" value="#ccc"/>    
+    <color name="table-cell" value="#ffffff"/>   
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#003366"/>
+        
+    <color name="footer" value="#E5E4D9"/>
+-->
+  </colors>
+ 
+  <!-- Settings specific to PDF output. -->
+  <pdf>
+    <!-- 
+       Supported page sizes are a0, a1, a2, a3, a4, a5, executive,
+       folio, legal, ledger, letter, quarto, tabloid (default letter).
+       Supported page orientations are portrait, landscape (default
+       portrait).
+       Supported text alignments are left, right, justify (default left).
+    -->
+    <page size="letter" orientation="portrait" text-align="left"/>
+
+    <!--
+       Margins can be specified for top, bottom, inner, and outer
+       edges. If double-sided="false", the inner edge is always left
+       and the outer is always right. If double-sided="true", the
+       inner edge will be left on odd pages, right on even pages,
+       the outer edge vice versa.
+       Specified below are the default settings.
+    -->
+    <margins double-sided="false">
+      <top>1in</top>
+      <bottom>1in</bottom>
+      <inner>1.25in</inner>
+      <outer>1in</outer>
+    </margins>
+
+    <!--
+      Print the URL text next to all links going outside the file
+    -->
+    <show-external-urls>false</show-external-urls>
+
+    <!--
+      Disable the copyright footer on each page of the PDF.
+      A footer is composed for each page. By default, a "credit" with role=pdf
+      will be used, as explained below. Otherwise a copyright statement
+      will be generated. This latter can be disabled.
+    -->
+    <disable-copyright-footer>false</disable-copyright-footer>
+  </pdf>
+
+  <!-- Credits are typically rendered as a set of small clickable
+    images in the page footer.
+    Use box-location="alt" to move the credit to an alternate location
+    (if the skin supports it). 
+  -->
+  <credits>
+    <credit box-location="alt">
+      <name>Built with Apache Forrest</name>
+      <url>http://forrest.apache.org/</url>
+      <image>images/built-with-forrest-button.png</image>
+      <width>88</width>
+      <height>31</height>
+    </credit>
+    <!-- A credit with @role="pdf" will be used to compose a footer
+     for each page in the PDF, using either "name" or "url" or both.
+    -->
+    <!--
+    <credit role="pdf">
+      <name>Built with Apache Forrest</name>
+      <url>http://forrest.apache.org/</url>
+    </credit>
+    -->
+  </credits>
+
+</skinconfig>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/status.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/status.xml b/zookeeper-docs/status.xml
new file mode 100644
index 0000000..3ac3fda
--- /dev/null
+++ b/zookeeper-docs/status.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<status>
+
+  <developers>
+    <person name="Joe Bloggs"      email="joe@joescompany.org"      id="JB" />
+    <!-- Add more people here -->
+  </developers>
+
+  <changes>
+    <!-- Add new releases here -->
+    <release version="0.1" date="unreleased">
+      <!-- Some action types have associated images. By default, images are
+      defined for 'add', 'fix', 'remove', 'update' and 'hack'. If you add
+      src/documentation/resources/images/<foo>.jpg images, these will
+      automatically be used for entries of type <foo>. -->
+
+      <action dev="JB" type="add" context="admin">
+        Initial Import
+      </action>
+      <!-- Sample action:
+      <action dev="JB" type="fix" due-to="Joe Contributor"
+          due-to-email="joec@apache.org" fixes-bug="123">
+          Fixed a bug in the Foo class.
+        </action>
+        -->
+    </release>
+  </changes>
+
+  <todo>
+    <actions priority="high">
+      <action context="docs" dev="JB">
+        Customize this template project with your project's details.  This
+        TODO list is generated from 'status.xml'.
+      </action>
+      <action context="docs" dev="JB">
+        Add lots of content.  XML content goes in
+        <code>src/documentation/content/xdocs</code>, or wherever the
+        <code>${project.xdocs-dir}</code> property (set in
+        <code>forrest.properties</code>) points.
+      </action>
+      <action context="feedback" dev="JB">
+        Mail <link
+          href="mailto:forrest-dev@xml.apache.org">forrest-dev@xml.apache.org</link>
+        with feedback.
+      </action>
+    </actions>
+    <!-- Add todo items. @context is an arbitrary string. Eg:
+    <actions priority="high">
+      <action context="code" dev="SN">
+      </action>
+    </actions>
+    <actions priority="medium">
+      <action context="docs" dev="open">
+      </action>
+    </actions>
+    -->
+  </todo>
+
+</status>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-it/.empty
----------------------------------------------------------------------
diff --git a/zookeeper-it/.empty b/zookeeper-it/.empty
new file mode 100644
index 0000000..e69de29


[09/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml b/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
deleted file mode 100644
index a2a978f..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
+++ /dev/null
@@ -1,2008 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_programmersGuide">
-  <title>ZooKeeper Programmer's Guide</title>
-
-  <subtitle>Developing Distributed Applications that use ZooKeeper</subtitle>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This guide contains detailed information about creating
-      distributed applications that use ZooKeeper. It discusses the basic
-      operations ZooKeeper supports, and how these can be used to build
-      higher-level abstractions. It contains solutions to common tasks, a
-      troubleshooting guide, and links to other information.</para>
-
-      <para>$Revision: 1.14 $ $Date: 2008/09/19 05:31:45 $</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="_introduction">
-    <title>Introduction</title>
-
-    <para>This document is a guide for developers wishing to create
-    distributed applications that take advantage of ZooKeeper's coordination
-    services. It contains conceptual and practical information.</para>
-
-    <para>The first four sections of this guide present higher level
-    discussions of various ZooKeeper concepts. These are necessary both for an
-    understanding of how ZooKeeper works as well how to work with it. It does
-    not contain source code, but it does assume a familiarity with the
-    problems associated with distributed computing. The sections in this first
-    group are:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para><xref linkend="ch_zkDataModel" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_zkSessions" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_zkWatches" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_zkGuarantees" /></para>
-      </listitem>
-    </itemizedlist>
-
-    <para>The next four sections provide practical programming
-    information. These are:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para><xref linkend="ch_guideToZkOperations" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_bindings" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_programStructureWithExample" />
-        <emphasis>[tbd]</emphasis></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="ch_gotchas" /></para>
-      </listitem>
-    </itemizedlist>
-
-    <para>The book concludes with an <ulink
-    url="#apx_linksToOtherInfo">appendix</ulink> containing links to other
-    useful, ZooKeeper-related information.</para>
-
-    <para>Most of information in this document is written to be accessible as
-    stand-alone reference material. However, before starting your first
-    ZooKeeper application, you should probably at least read the chaptes on
-    the <ulink url="#ch_zkDataModel">ZooKeeper Data Model</ulink> and <ulink
-    url="#ch_guideToZkOperations">ZooKeeper Basic Operations</ulink>. Also,
-    the <ulink url="#ch_programStructureWithExample">Simple Programmming
-    Example</ulink> <emphasis>[tbd]</emphasis> is helpful for understanding the basic
-    structure of a ZooKeeper client application.</para>
-  </section>
-
-  <section id="ch_zkDataModel">
-    <title>The ZooKeeper Data Model</title>
-
-    <para>ZooKeeper has a hierarchal name space, much like a distributed file
-    system. The only difference is that each node in the namespace can have
-    data associated with it as well as children. It is like having a file
-    system that allows a file to also be a directory. Paths to nodes are
-    always expressed as canonical, absolute, slash-separated paths; there are
-    no relative reference. Any unicode character can be used in a path subject
-    to the following constraints:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para>The null character (\u0000) cannot be part of a path name. (This
-        causes problems with the C binding.)</para>
-      </listitem>
-
-      <listitem>
-        <para>The following characters can't be used because they don't
-        display well, or render in confusing ways: \u0001 - \u001F and \u007F
-        - \u009F.</para>
-      </listitem>
-
-      <listitem>
-        <para>The following characters are not allowed: \ud800 - uF8FF,
-        \uFFF0 - uFFFF.</para>
-      </listitem>
-
-      <listitem>
-        <para>The "." character can be used as part of another name, but "."
-        and ".." cannot alone be used to indicate a node along a path,
-        because ZooKeeper doesn't use relative paths. The following would be
-        invalid: "/a/b/./c" or "/a/b/../c".</para>
-      </listitem>
-
-      <listitem>
-        <para>The token "zookeeper" is reserved.</para>
-      </listitem>
-    </itemizedlist>
-
-    <section id="sc_zkDataModel_znodes">
-      <title>ZNodes</title>
-
-      <para>Every node in a ZooKeeper tree is referred to as a
-      <emphasis>znode</emphasis>. Znodes maintain a stat structure that
-      includes version numbers for data changes, acl changes. The stat
-      structure also has timestamps. The version number, together with the
-      timestamp, allows ZooKeeper to validate the cache and to coordinate
-      updates. Each time a znode's data changes, the version number increases.
-      For instance, whenever a client retrieves data, it also receives the
-      version of the data. And when a client performs an update or a delete,
-      it must supply the version of the data of the znode it is changing. If
-      the version it supplies doesn't match the actual version of the data,
-      the update will fail. (This behavior can be overridden. For more
-      information see... )<emphasis>[tbd...]</emphasis></para>
-
-      <note>
-        <para>In distributed application engineering, the word
-        <emphasis>node</emphasis> can refer to a generic host machine, a
-        server, a member of an ensemble, a client process, etc. In the ZooKeeper
-        documentation, <emphasis>znodes</emphasis> refer to the data nodes.
-        <emphasis>Servers</emphasis>  refer to machines that make up the
-        ZooKeeper service; <emphasis>quorum peers</emphasis> refer to the
-        servers that make up an ensemble; client refers to any host or process
-        which uses a ZooKeeper service.</para>
-      </note>
-
-      <para>Znodes are the main enitity that a programmer access. They have
-      several characteristics that are worth mentioning here.</para>
-
-      <section id="sc_zkDataMode_watches">
-        <title>Watches</title>
-
-        <para>Clients can set watches on znodes. Changes to that znode trigger
-        the watch and then clear the watch. When a watch triggers, ZooKeeper
-        sends the client a notification. More information about watches can be
-        found in the section 
-	    <ulink url="#ch_zkWatches">ZooKeeper Watches</ulink>.</para>
-      </section>
-
-      <section>
-        <title>Data Access</title>
-
-        <para>The data stored at each znode in a namespace is read and written
-        atomically. Reads get all the data bytes associated with a znode and a
-        write replaces all the data. Each node has an Access Control List
-        (ACL) that restricts who can do what.</para>
-        
-        <para>ZooKeeper was not designed to be a general database or large
-        object store. Instead, it manages coordination data. This data can
-        come in the form of configuration, status information, rendezvous, etc.
-        A common property of the various forms of coordination data is that
-        they are relatively small: measured in kilobytes.
-        The ZooKeeper client and the server implementations have sanity checks
-        to ensure that znodes have less than 1M of data, but the data should
-        be much less than that on average. Operating on relatively large data
-        sizes will cause some operations to take much more time than others and
-        will affect the latencies of some operations because of the extra time
-        needed to move more data over the network and onto storage media. If
-        large data storage is needed, the usually pattern of dealing with such
-        data is to store it on a bulk storage system, such as NFS or HDFS, and
-        store pointers to the storage locations in ZooKeeper.</para> 
-      </section>
-
-      <section>
-        <title>Ephemeral Nodes</title>
-
-        <para>ZooKeeper also has the notion of ephemeral nodes. These znodes
-        exists as long as the session that created the znode is active. When
-        the session ends the znode is deleted. Because of this behavior
-        ephemeral znodes are not allowed to have children.</para>
-      </section>
-
-      <section>
-        <title>Sequence Nodes -- Unique Naming</title>
-
-        <para>When creating a znode you can also request that
-        ZooKeeper append a monotonically increasing counter to the end
-        of path. This counter is unique to the parent znode. The
-        counter has a format of %010d -- that is 10 digits with 0
-        (zero) padding (the counter is formatted in this way to
-        simplify sorting), i.e. "&lt;path&gt;0000000001". See
-        <ulink url="recipes.html#sc_recipes_Queues">Queue
-        Recipe</ulink> for an example use of this feature. Note: the
-        counter used to store the next sequence number is a signed int
-        (4bytes) maintained by the parent node, the counter will
-        overflow when incremented beyond 2147483647 (resulting in a
-        name "&lt;path&gt;-2147483648").</para>
-      </section>
-
-      <section>
-        <title>Container Nodes</title>
-
-        <para><emphasis role="bold">Added in 3.6.0</emphasis></para>
-
-        <para>ZooKeeper has the notion of container znodes. Container znodes are
-          special purpose znodes useful for recipes such as leader, lock, etc.
-          When the last child of a container is deleted, the container becomes
-          a candidate to be deleted by the server at some point in the future.</para>
-
-        <para>Given this property, you should be prepared to get
-          KeeperException.NoNodeException when creating children inside of
-          container znodes. i.e. when creating child znodes inside of container znodes
-          always check for KeeperException.NoNodeException and recreate the container
-          znode when it occurs.</para>
-      </section>
-
-      <section>
-        <title>TTL Nodes</title>
-
-        <para><emphasis role="bold">Added in 3.6.0</emphasis></para>
-
-        <para>When creating PERSISTENT or PERSISTENT_SEQUENTIAL znodes,
-          you can optionally set a TTL in milliseconds for the znode. If the znode
-          is not modified within the TTL and has no children it will become a candidate
-          to be deleted by the server at some point in the future.</para>
-
-        <para>Note: TTL Nodes must be enabled via System property as
-        they are disabled by default. See the <ulink url="zookeeperAdmin.html#sc_configuration">Administrator's
-        Guide</ulink> for details. If you attempt to create TTL Nodes without the proper System property set the server
-        will throw <emphasis>KeeperException.UnimplementedException</emphasis>.</para>
-      </section>
-    </section>
-
-    <section id="sc_timeInZk">
-      <title>Time in ZooKeeper</title>
-
-      <para>ZooKeeper tracks time multiple ways:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para><emphasis role="bold">Zxid</emphasis></para>
-
-          <para>Every change to the ZooKeeper state receives a stamp in the
-          form of a <emphasis>zxid</emphasis> (ZooKeeper Transaction Id).
-          This exposes the total ordering of all changes to ZooKeeper. Each
-          change will have a unique zxid and if zxid1 is smaller than zxid2
-          then zxid1 happened before zxid2.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">Version numbers</emphasis></para>
-
-          <para>Every change to a node will cause an increase to one of the
-          version numbers of that node. The three version numbers are version
-          (number of changes to the data of a znode), cversion (number of
-          changes to the children of a znode), and aversion (number of changes
-          to the ACL of a znode).</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">Ticks</emphasis></para>
-
-          <para>When using multi-server ZooKeeper, servers use ticks to define
-          timing of events such as status uploads, session timeouts,
-          connection timeouts between peers, etc. The tick time is only
-          indirectly exposed through the minimum session timeout (2 times the
-          tick time); if a client requests a session timeout less than the
-          minimum session timeout, the server will tell the client that the
-          session timeout is actually the minimum session timeout.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">Real time</emphasis></para>
-
-          <para>ZooKeeper doesn't use real time, or clock time, at all except
-          to put timestamps into the stat structure on znode creation and
-          znode modification.</para>
-        </listitem>
-      </itemizedlist>
-    </section>
-
-    <section id="sc_zkStatStructure">
-      <title>ZooKeeper Stat Structure</title>
-
-      <para>The Stat structure for each znode in ZooKeeper is made up of the
-      following fields:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para><emphasis role="bold">czxid</emphasis></para>
-
-          <para>The zxid of the change that caused this znode to be
-          created.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">mzxid</emphasis></para>
-
-          <para>The zxid of the change that last modified this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">pzxid</emphasis></para>
-
-          <para>The zxid of the change that last modified children of this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">ctime</emphasis></para>
-
-          <para>The time in milliseconds from epoch when this znode was
-          created.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">mtime</emphasis></para>
-
-          <para>The time in milliseconds from epoch when this znode was last
-          modified.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">version</emphasis></para>
-
-          <para>The number of changes to the data of this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">cversion</emphasis></para>
-
-          <para>The number of changes to the children of this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">aversion</emphasis></para>
-
-          <para>The number of changes to the ACL of this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">ephemeralOwner</emphasis></para>
-
-          <para>The session id of the owner of this znode if the znode is an
-          ephemeral node. If it is not an ephemeral node, it will be
-          zero.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">dataLength</emphasis></para>
-
-          <para>The length of the data field of this znode.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">numChildren</emphasis></para>
-
-          <para>The number of children of this znode.</para>
-        </listitem>
-
-      </itemizedlist>
-    </section>
-  </section>
-
-  <section id="ch_zkSessions">
-    <title>ZooKeeper Sessions</title>
-
-    <para>A ZooKeeper client establishes a session with the ZooKeeper
-    service by creating a handle to the service using a language
-    binding. Once created, the handle starts of in the CONNECTING state
-    and the client library tries to connect to one of the servers that
-    make up the ZooKeeper service at which point it switches to the
-    CONNECTED state. During normal operation will be in one of these
-    two states. If an unrecoverable error occurs, such as session
-    expiration or authentication failure, or if the application explicitly
-    closes the handle, the handle will move to the CLOSED state.
-    The following figure shows the possible state transitions of a
-    ZooKeeper client:</para>
-    
-    <mediaobject id="fg_states" >
-  		<imageobject>
-    		<imagedata fileref="images/state_dia.jpg"/>
-  		</imageobject>
-	</mediaobject>
-    
-    <para>To create a client session the application code must provide
-    a connection string containing a comma separated list of host:port pairs,
-    each corresponding to a ZooKeeper server (e.g. "127.0.0.1:4545" or
-    "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"). The ZooKeeper
-    client library will pick an arbitrary server and try to connect to
-    it. If this connection fails, or if the client becomes
-    disconnected from the server for any reason, the client will
-    automatically try the next server in the list, until a connection
-    is (re-)established.</para>
-
-    <para> <emphasis role="bold">Added in 3.2.0</emphasis>: An
-    optional "chroot" suffix may also be appended to the connection
-    string. This will run the client commands while interpreting all
-    paths relative to this root (similar to the unix chroot
-    command). If used the example would look like:
-    "127.0.0.1:4545/app/a" or
-    "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a" where the
-    client would be rooted at "/app/a" and all paths would be relative
-    to this root - ie getting/setting/etc...  "/foo/bar" would result
-    in operations being run on "/app/a/foo/bar" (from the server
-    perspective). This feature is particularly useful in multi-tenant
-    environments where each user of a particular ZooKeeper service
-    could be rooted differently. This makes re-use much simpler as
-    each user can code his/her application as if it were rooted at
-    "/", while actual location (say /app/a) could be determined at
-    deployment time.</para>
-
-    <para>When a client gets a handle to the ZooKeeper service,
-    ZooKeeper creates a ZooKeeper session, represented as a 64-bit
-    number, that it assigns to the client. If the client connects to a
-    different ZooKeeper server, it will send the session id as a part
-    of the connection handshake.  As a security measure, the server
-    creates a password for the session id that any ZooKeeper server
-    can validate.The password is sent to the client with the session
-    id when the client establishes the session. The client sends this
-    password with the session id whenever it reestablishes the session
-    with a new server.</para>
-
-    <para>One of the parameters to the ZooKeeper client library call
-    to create a ZooKeeper session is the session timeout in
-    milliseconds. The client sends a requested timeout, the server
-    responds with the timeout that it can give the client. The current
-    implementation requires that the timeout be a minimum of 2 times
-    the tickTime (as set in the server configuration) and a maximum of
-    20 times the tickTime. The ZooKeeper client API allows access to
-    the negotiated timeout.</para>
-
-    <para>When a client (session) becomes partitioned from the ZK
-    serving cluster it will begin searching the list of servers that
-    were specified during session creation. Eventually, when
-    connectivity between the client and at least one of the servers is
-    re-established, the session will either again transition to the
-    "connected" state (if reconnected within the session timeout
-    value) or it will transition to the "expired" state (if
-    reconnected after the session timeout). It is not advisable to
-    create a new session object (a new ZooKeeper.class or zookeeper
-    handle in the c binding) for disconnection. The ZK client library
-    will handle reconnect for you. In particular we have heuristics
-    built into the client library to handle things like "herd effect",
-    etc... Only create a new session when you are notified of session
-    expiration (mandatory).</para>
-
-    <para>Session expiration is managed by the ZooKeeper cluster
-    itself, not by the client. When the ZK client establishes a
-    session with the cluster it provides a "timeout" value detailed
-    above. This value is used by the cluster to determine when the
-    client's session expires. Expirations happens when the cluster
-    does not hear from the client within the specified session timeout
-    period (i.e. no heartbeat). At session expiration the cluster will
-    delete any/all ephemeral nodes owned by that session and
-    immediately notify any/all connected clients of the change (anyone
-    watching those znodes). At this point the client of the expired
-    session is still disconnected from the cluster, it will not be
-    notified of the session expiration until/unless it is able to
-    re-establish a connection to the cluster. The client will stay in
-    disconnected state until the TCP connection is re-established with
-    the cluster, at which point the watcher of the expired session
-    will receive the "session expired" notification.</para>
-
-    <para>Example state transitions for an expired session as seen by
-    the expired session's watcher:</para>
-
-    <orderedlist>
-      <listitem><para>'connected' : session is established and client
-      is communicating with cluster (client/server communication is
-      operating properly)</para></listitem>
-      <listitem><para>.... client is partitioned from the
-      cluster</para></listitem>
-      <listitem><para>'disconnected' : client has lost connectivity
-      with the cluster</para></listitem>
-      <listitem><para>.... time elapses, after 'timeout' period the
-      cluster expires the session, nothing is seen by client as it is
-      disconnected from cluster</para></listitem>
-      <listitem><para>.... time elapses, the client regains network
-      level connectivity with the cluster</para></listitem>
-      <listitem><para>'expired' : eventually the client reconnects to
-      the cluster, it is then notified of the
-      expiration</para></listitem>
-    </orderedlist>
-
-    <para>Another parameter to the ZooKeeper session establishment
-    call is the default watcher. Watchers are notified when any state
-    change occurs in the client. For example if the client loses
-    connectivity to the server the client will be notified, or if the
-    client's session expires, etc... This watcher should consider the
-    initial state to be disconnected (i.e. before any state changes
-    events are sent to the watcher by the client lib). In the case of
-    a new connection, the first event sent to the watcher is typically
-    the session connection event.</para>
-
-    <para>The session is kept alive by requests sent by the client. If
-    the session is idle for a period of time that would timeout the
-    session, the client will send a PING request to keep the session
-    alive. This PING request not only allows the ZooKeeper server to
-    know that the client is still active, but it also allows the
-    client to verify that its connection to the ZooKeeper server is
-    still active. The timing of the PING is conservative enough to
-    ensure reasonable time to detect a dead connection and reconnect
-    to a new server.</para>
-
-    <para>
-      Once a connection to the server is successfully established
-      (connected) there are basically two cases where the client lib generates
-      connectionloss (the result code in c binding, exception in Java -- see 
-      the API documentation for binding specific details) when either a synchronous or
-      asynchronous operation is performed and one of the following holds:
-    </para>
-
-    <orderedlist>
-      <listitem><para>The application calls an operation on a session that is no
-      longer alive/valid</para></listitem>
-      <listitem><para>The ZooKeeper client disconnects from a server when there
-      are pending operations to that server, i.e., there is a pending asynchronous call.
-      </para></listitem>
-    </orderedlist>
-
-    <para> <emphasis role="bold">Added in 3.2.0 -- SessionMovedException</emphasis>. There is an internal
-      exception that is generally not seen by clients called the SessionMovedException.
-      This exception occurs because a request was received on a connection for a session
-      which has been reestablished on a different server. The normal cause of this error is
-      a client that sends a request to a server, but the network packet gets delayed, so
-      the client times out and connects to a new server. When the delayed packet arrives at
-      the first server, the old server detects that the session has moved, and closes the
-      client connection. Clients normally do not see this error since they do not read
-      from those old connections. (Old connections are usually closed.) One situation in which this
-      condition can be seen is when two clients try to reestablish the same connection using
-      a saved session id and password. One of the clients will reestablish the connection
-      and the second client will be disconnected (causing the pair to attempt to re-establish
-      its connection/session indefinitely).</para>
-
-    <para> <emphasis role="bold">Updating the list of servers</emphasis>.  We allow a client to 
-      update the connection string by providing a new comma separated list of host:port pairs, 
-      each corresponding to a ZooKeeper server. The function invokes a probabilistic load-balancing 
-      algorithm which may cause the client to disconnect from its current host with the goal
-      to achieve expected uniform number of connections per server in the new list. 
-      In case the current host to which the client is connected is not in the new list
-      this call will always cause the connection to be dropped. Otherwise, the decision
-	  is based on whether the number of servers has increased or decreased and by how much.	
-	</para>
-
-    <para>
-      For example, if the previous connection string contained 3 hosts and now the list contains
-      these 3 hosts and 2 more hosts, 40% of clients connected to each of the 3 hosts will
-      move to one of the new hosts in order to balance the load. The algorithm will cause the client 
-      to drop its connection to the current host to which it is connected with probability 0.4 and in this 
-	  case cause the client to connect to one of the 2 new hosts, chosen at random.
-    </para>
-
-	<para>
-	  Another example -- suppose we have 5 hosts and now update the list to remove 2 of the hosts, 
-	  the clients connected to the 3 remaining hosts will stay connected, whereas all clients connected 
-	  to the 2 removed hosts will need to move to one of the 3 hosts, chosen at random. If the connection
-	  is dropped, the client moves to a special mode where he chooses a new server to connect to using the
-	  probabilistic algorithm, and not just round robin. 
-    </para>
-
-    <para>
-	  In the first example, each client decides to disconnect with probability 0.4 but once the decision is
-	  made, it will try to connect to a random new server and only if it cannot connect to any of the new 
-	  servers will it try to connect to the old ones. After finding a server, or trying all servers in the 
-	  new list and failing to connect, the client moves back to the normal mode of operation where it picks
-	  an arbitrary server from the connectString and attempt to connect to it. If that fails, is will continue
-	  trying different random servers in round robin. (see above the algorithm used to initially choose a server)
-    </para>
-
-  </section>
-
-  <section id="ch_zkWatches">
-    <title>ZooKeeper Watches</title>
-
-    <para>All of the read operations in ZooKeeper - <emphasis
-    role="bold">getData()</emphasis>, <emphasis
-    role="bold">getChildren()</emphasis>, and <emphasis
-    role="bold">exists()</emphasis> - have the option of setting a watch as a
-    side effect. Here is ZooKeeper's definition of a watch: a watch event is
-    one-time trigger, sent to the client that set the watch, which occurs when
-    the data for which the watch was set changes. There are three key points
-    to consider in this definition of a watch:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para><emphasis role="bold">One-time trigger</emphasis></para>
-
-        <para>One watch event will be sent to the client when the data has changed.
-        For example, if a client does a getData("/znode1", true) and later the
-        data for /znode1 is changed or deleted, the client will get a watch
-        event for /znode1. If /znode1 changes again, no watch event will be
-        sent unless the client has done another read that sets a new
-        watch.</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">Sent to the client</emphasis></para>
-
-        <para>This implies that an event is on the way to the client, but may
-        not reach the client before the successful return code to the change
-        operation reaches the client that initiated the change. Watches are
-        sent asynchronously to watchers. ZooKeeper provides an ordering
-        guarantee: a client will never see a change for which it has set a
-        watch until it first sees the watch event. Network delays or other
-        factors may cause different clients to see watches and return codes
-        from updates at different times. The key point is that everything seen
-        by the different clients will have a consistent order.</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">The data for which the watch was
-        set</emphasis></para>
-
-        <para>This refers to the different ways a node can change.  It
-        helps to think of ZooKeeper as maintaining two lists of
-        watches: data watches and child watches.  getData() and
-        exists() set data watches. getChildren() sets child
-        watches. Alternatively, it may help to think of watches being
-        set according to the kind of data returned. getData() and
-        exists() return information about the data of the node,
-        whereas getChildren() returns a list of children.  Thus,
-        setData() will trigger data watches for the znode being set
-        (assuming the set is successful). A successful create() will
-        trigger a data watch for the znode being created and a child
-        watch for the parent znode. A successful delete() will trigger
-        both a data watch and a child watch (since there can be no
-        more children) for a znode being deleted as well as a child
-        watch for the parent znode.</para>
-      </listitem>
-    </itemizedlist>
-
-    <para>Watches are maintained locally at the ZooKeeper server to which the
-    client is connected. This allows watches to be lightweight to set,
-    maintain, and dispatch. When a client connects to a new server, the watch
-    will be triggered for any session events. Watches will not be received
-    while disconnected from a server. When a client reconnects, any previously
-    registered watches will be reregistered and triggered if needed. In
-    general this all occurs transparently. There is one case where a watch
-    may be missed: a watch for the existence of a znode not yet created will
-    be missed if the znode is created and deleted while disconnected.</para>
-
-	<section id="sc_WatchSemantics">
-      <title>Semantics of Watches</title>
-	  
-	  <para> We can set watches with the three calls that read the state of 
-	  ZooKeeper: exists, getData, and getChildren. The following list details
-	  the events that a watch can trigger and the calls that enable them:
-	  </para>
-	  
-	  <itemizedlist>
-        <listitem>
-          <para><emphasis role="bold">Created event:</emphasis></para>
-          <para>Enabled with a call to exists.</para>
-        </listitem>
-        
-        <listitem>
-          <para><emphasis role="bold">Deleted event:</emphasis></para>
-          <para>Enabled with a call to exists, getData, and getChildren.</para>
-        </listitem>
-        
-        <listitem>
-          <para><emphasis role="bold">Changed event:</emphasis></para>
-          <para>Enabled with a call to exists and getData.</para>
-        </listitem>
-        
-        <listitem>
-          <para><emphasis role="bold">Child event:</emphasis></para>
-          <para>Enabled with a call to getChildren.</para>
-        </listitem>
-      </itemizedlist>
-	</section>
-
-    <section id="sc_WatchRemoval">
-      <title>Remove Watches</title>
-      <para>We can remove the watches registered on a znode with a call to 
-      removeWatches. Also, a ZooKeeper client can remove watches locally even
-      if there is no server connection by setting the local flag to true. The 
-      following list details the events which will be triggered after the 
-      successful watch removal.
-      </para>
-      <itemizedlist>
-        <listitem>
-          <para><emphasis role="bold">Child Remove event:</emphasis></para>
-          <para>Watcher which was added with a call to getChildren.</para>
-        </listitem>
-        
-        <listitem>
-          <para><emphasis role="bold">Data Remove event:</emphasis></para>
-          <para>Watcher which was added with a call to exists or getData.</para>
-        </listitem>
-      </itemizedlist>
-   </section>
-
-    <section id="sc_WatchGuarantees">
-      <title>What ZooKeeper Guarantees about Watches</title>
-
-      <para>With regard to watches, ZooKeeper maintains these
-      guarantees:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>Watches are ordered with respect to other events, other
-          watches, and asynchronous replies. The ZooKeeper client libraries
-          ensures that everything is dispatched in order.</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>A client will see a watch event for a znode it is watching
-          before seeing the new data that corresponds to that znode.</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>The order of watch events from ZooKeeper corresponds to the
-          order of the updates as seen by the ZooKeeper service.</para>
-        </listitem>
-      </itemizedlist>
-    </section>
-
-    <section id="sc_WatchRememberThese">
-      <title>Things to Remember about Watches</title>
-
-      <itemizedlist>
-        <listitem>
-          <para>Watches are one time triggers; if you get a watch event and
-          you want to get notified of future changes, you must set another
-          watch.</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>Because watches are one time triggers and there is latency
-          between getting the event and sending a new request to get a watch
-          you cannot reliably see every change that happens to a node in
-          ZooKeeper. Be prepared to handle the case where the znode changes
-          multiple times between getting the event and setting the watch
-          again. (You may not care, but at least realize it may
-          happen.)</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>A watch object, or function/context pair, will only be
-          triggered once for a given notification. For example, if the same
-          watch object is registered for an exists and a getData call for the
-          same file and that file is then deleted, the watch object would
-          only be invoked once with the deletion notification for the file.
-          </para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>When you disconnect from a server (for example, when the
-          server fails), you will not get any watches until the connection
-          is reestablished. For this reason session events are sent to all
-          outstanding watch handlers. Use session events to go into a safe
-          mode: you will not be receiving events while disconnected, so your
-          process should act conservatively in that mode.</para>
-        </listitem>
-      </itemizedlist>
-    </section>
-  </section>
-
-  <section id="sc_ZooKeeperAccessControl">
-    <title>ZooKeeper access control using ACLs</title>
-
-    <para>ZooKeeper uses ACLs to control access to its znodes (the
-    data nodes of a ZooKeeper data tree). The ACL implementation is
-    quite similar to UNIX file access permissions: it employs
-    permission bits to allow/disallow various operations against a
-    node and the scope to which the bits apply. Unlike standard UNIX
-    permissions, a ZooKeeper node is not limited by the three standard
-    scopes for user (owner of the file), group, and world
-    (other). ZooKeeper does not have a notion of an owner of a
-    znode. Instead, an ACL specifies sets of ids and permissions that
-    are associated with those ids.</para>
-
-    <para>Note also that an ACL pertains only to a specific znode. In
-    particular it does not apply to children. For example, if
-    <emphasis>/app</emphasis> is only readable by ip:172.16.16.1 and
-    <emphasis>/app/status</emphasis> is world readable, anyone will
-    be able to read <emphasis>/app/status</emphasis>; ACLs are not
-    recursive.</para>
-
-    <para>ZooKeeper supports pluggable authentication schemes. Ids are
-    specified using the form <emphasis>scheme:expression</emphasis>,
-    where <emphasis>scheme</emphasis> is the authentication scheme
-    that the id corresponds to. The set of valid expressions are defined
-    by the scheme. For example, <emphasis>ip:172.16.16.1</emphasis> is
-    an id for a host with the address <emphasis>172.16.16.1</emphasis>
-    using the <emphasis>ip</emphasis> scheme, whereas <emphasis>digest:bob:password</emphasis>
-    is an id for the user with the name of <emphasis>bob</emphasis> using
-    the <emphasis>digest</emphasis> scheme.</para>
-
-    <para>When a client connects to ZooKeeper and authenticates
-    itself, ZooKeeper associates all the ids that correspond to a
-    client with the clients connection. These ids are checked against
-    the ACLs of znodes when a clients tries to access a node. ACLs are
-    made up of pairs of <emphasis>(scheme:expression,
-    perms)</emphasis>. The format of
-    the <emphasis>expression</emphasis> is specific to the scheme. For
-    example, the pair <emphasis>(ip:19.22.0.0/16, READ)</emphasis>
-    gives the <emphasis>READ</emphasis> permission to any clients with
-    an IP address that starts with 19.22.</para>
-
-    <section id="sc_ACLPermissions">
-      <title>ACL Permissions</title>
-                               
-      <para>ZooKeeper supports the following permissions:</para>
-
-      <itemizedlist>
-        <listitem><para><emphasis role="bold">CREATE</emphasis>: you can create a child node</para></listitem>
-        <listitem><para><emphasis role="bold">READ</emphasis>: you can get data from a node and list its children.</para></listitem>
-        <listitem><para><emphasis role="bold">WRITE</emphasis>: you can set data for a node</para></listitem>
-        <listitem><para><emphasis role="bold">DELETE</emphasis>: you can delete a child node</para></listitem>
-        <listitem><para><emphasis role="bold">ADMIN</emphasis>: you can set permissions</para></listitem>
-      </itemizedlist>
-
-      <para>The <emphasis>CREATE</emphasis>
-      and <emphasis>DELETE</emphasis> permissions have been broken out
-      of the <emphasis>WRITE</emphasis> permission for finer grained
-      access controls. The cases for <emphasis>CREATE</emphasis>
-      and <emphasis>DELETE</emphasis> are the following:</para>
-
-      <para>You want A to be able to do a set on a ZooKeeper node, but
-      not be able to <emphasis>CREATE</emphasis>
-      or <emphasis>DELETE</emphasis> children.</para>
-
-      <para><emphasis>CREATE</emphasis>
-      without <emphasis>DELETE</emphasis>: clients create requests by
-      creating ZooKeeper nodes in a parent directory. You want all
-      clients to be able to add, but only request processor can
-      delete. (This is kind of like the APPEND permission for
-      files.)</para>
-
-      <para>Also, the <emphasis>ADMIN</emphasis> permission is there
-      since ZooKeeper doesn’t have a notion of file owner. In some
-      sense the <emphasis>ADMIN</emphasis> permission designates the
-      entity as the owner. ZooKeeper doesn’t support the LOOKUP
-      permission (execute permission bit on directories to allow you
-      to LOOKUP even though you can't list the directory). Everyone
-      implicitly has LOOKUP permission. This allows you to stat a
-      node, but nothing more. (The problem is, if you want to call
-      zoo_exists() on a node that doesn't exist, there is no
-      permission to check.)</para>
-
-    <section id="sc_BuiltinACLSchemes">
-      <title>Builtin ACL Schemes</title>
-
-      <para>ZooKeeeper has the following built in schemes:</para>
-
-      <itemizedlist>
-        <listitem><para><emphasis role="bold">world</emphasis> has a
-        single id, <emphasis>anyone</emphasis>, that represents
-        anyone.</para></listitem>
-
-        <listitem><para><emphasis role="bold">auth</emphasis> is a special
-        scheme which ignores any provided expression and instead uses the current user,
-        credentials, and scheme. Any expression (whether <emphasis>user</emphasis> like with SASL
-        authentication or <emphasis>user:password</emphasis> like with DIGEST authentication) provided is ignored
-        by the ZooKeeper server when persisting the ACL. However, the expression must still be
-        provided in the ACL because the ACL must match the form <emphasis>scheme:expression:perms</emphasis>.
-        This scheme is provided as a convenience as it is a common use-case for
-        a user to create a znode and then restrict access to that znode to only that user.
-        If there is no authenticated user, setting an ACL with the auth scheme will fail.
-        </para></listitem>
-
-        <listitem><para><emphasis role="bold">digest</emphasis> uses
-        a <emphasis>username:password</emphasis> string to generate
-        MD5 hash which is then used as an ACL ID
-        identity. Authentication is done by sending
-        the <emphasis>username:password</emphasis> in clear text. When
-        used in the ACL the expression will be
-        the <emphasis>username:base64</emphasis>
-        encoded <emphasis>SHA1</emphasis>
-        password <emphasis>digest</emphasis>.</para>
-        </listitem>
-
-        <listitem><para><emphasis role="bold">ip</emphasis> uses the
-        client host IP as an ACL ID identity. The ACL expression is of
-        the form <emphasis>addr/bits</emphasis> where the most
-        significant <emphasis>bits</emphasis>
-        of <emphasis>addr</emphasis> are matched against the most
-        significant <emphasis>bits</emphasis> of the client host
-        IP.</para></listitem>
-
-        <listitem><para><emphasis role="bold">x509</emphasis> uses the client
-        X500 Principal as an ACL ID identity. The ACL expression is the exact
-        X500 Principal name of a client. When using the secure port, clients
-        are automatically authenticated and their auth info for the x509 scheme
-        is set.</para></listitem>
-
-      </itemizedlist>
-    </section>
-
-    <section>
-      <title>ZooKeeper C client API</title>
-
-      <para>The following constants are provided by the ZooKeeper C
-      library:</para>
-
-      <itemizedlist>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_READ; //can read node’s value and list its children</para></listitem>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_WRITE;// can set the node’s value</para></listitem>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_CREATE; //can create children</para></listitem>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_DELETE;// can delete children</para></listitem>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_ADMIN; //can execute set_acl()</para></listitem>
-        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_ALL;// all of the above flags OR’d together</para></listitem>
-      </itemizedlist>
-
-      <para>The following are the standard ACL IDs:</para>
-
-      <itemizedlist>
-        <listitem><para><emphasis>struct</emphasis> Id ZOO_ANYONE_ID_UNSAFE; //(‘world’,’anyone’)</para></listitem>
-        <listitem><para><emphasis>struct</emphasis> Id ZOO_AUTH_IDS;// (‘auth’,’’)</para></listitem>
-      </itemizedlist>
-
-      <para>ZOO_AUTH_IDS empty identity string should be interpreted as “the identity of the creator”.</para>
-
-      <para>ZooKeeper client comes with three standard ACLs:</para>
-
-      <itemizedlist>
-        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_OPEN_ACL_UNSAFE; //(ZOO_PERM_ALL,ZOO_ANYONE_ID_UNSAFE)</para></listitem>
-        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_READ_ACL_UNSAFE;// (ZOO_PERM_READ, ZOO_ANYONE_ID_UNSAFE)</para></listitem>
-        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_CREATOR_ALL_ACL; //(ZOO_PERM_ALL,ZOO_AUTH_IDS)</para></listitem>
-      </itemizedlist>
-
-      <para>The ZOO_OPEN_ACL_UNSAFE is completely open free for all
-      ACL: any application can execute any operation on the node and
-      can create, list and delete its children. The
-      ZOO_READ_ACL_UNSAFE is read-only access for any
-      application. CREATE_ALL_ACL grants all permissions to the
-      creator of the node. The creator must have been authenticated by
-      the server (for example, using “<emphasis>digest</emphasis>”
-      scheme) before it can create nodes with this ACL.</para>
-
-      <para>The following ZooKeeper operations deal with ACLs:</para>
-
-      <itemizedlist><listitem>
-          <para><emphasis>int</emphasis> <emphasis>zoo_add_auth</emphasis>
-            (zhandle_t *zh,<emphasis>const</emphasis> <emphasis>char</emphasis>*
-            scheme,<emphasis>const</emphasis> <emphasis>char</emphasis>*
-            cert, <emphasis>int</emphasis> certLen, void_completion_t
-            completion, <emphasis>const</emphasis> <emphasis>void</emphasis>
-            *data);</para>
-      </listitem></itemizedlist>
-
-      <para>The application uses the zoo_add_auth function to
-      authenticate itself to the server. The function can be called
-      multiple times if the application wants to authenticate using
-      different schemes and/or identities.</para>
-
-      <itemizedlist><listitem>
-          <para><emphasis>int</emphasis> <emphasis>zoo_create</emphasis>
-            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
-            *path, <emphasis>const</emphasis> <emphasis>char</emphasis>
-            *value,<emphasis>int</emphasis>
-            valuelen, <emphasis>const</emphasis> <emphasis>struct</emphasis>
-            ACL_vector *acl, <emphasis>int</emphasis>
-            flags,<emphasis>char</emphasis>
-            *realpath, <emphasis>int</emphasis>
-            max_realpath_len);</para>
-      </listitem></itemizedlist>
-
-      <para>zoo_create(...) operation creates a new node. The acl
-      parameter is a list of ACLs associated with the node. The parent
-      node must have the CREATE permission bit set.</para>
-
-      <itemizedlist><listitem>
-          <para><emphasis>int</emphasis> <emphasis>zoo_get_acl</emphasis>
-            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
-            *path,<emphasis>struct</emphasis> ACL_vector
-            *acl, <emphasis>struct</emphasis> Stat *stat);</para>
-      </listitem></itemizedlist>
-
-      <para>This operation returns a node’s ACL info.</para>
-
-      <itemizedlist><listitem>
-          <para><emphasis>int</emphasis> <emphasis>zoo_set_acl</emphasis>
-            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
-            *path, <emphasis>int</emphasis>
-            version,<emphasis>const</emphasis> <emphasis>struct</emphasis>
-            ACL_vector *acl);</para>
-      </listitem></itemizedlist>
-
-      <para>This function replaces node’s ACL list with a new one. The
-      node must have the ADMIN permission set.</para>
-
-      <para>Here is a sample code that makes use of the above APIs to
-      authenticate itself using the “<emphasis>foo</emphasis>” scheme
-      and create an ephemeral node “/xyz” with create-only
-      permissions.</para>
-
-      <note><para>This is a very simple example which is intended to show
-        how to interact with ZooKeeper ACLs
-        specifically. See <filename>.../trunk/src/c/src/cli.c</filename>
-        for an example of a C client implementation</para>
-      </note>
-
-      <programlisting>
-#include &lt;string.h>
-#include &lt;errno.h>
-
-#include "zookeeper.h"
-
-static zhandle_t *zh;
-
-/**
- * In this example this method gets the cert for your
- *   environment -- you must provide
- */
-char *foo_get_cert_once(char* id) { return 0; }
-
-/** Watcher function -- empty for this example, not something you should
- * do in real code */
-void watcher(zhandle_t *zzh, int type, int state, const char *path,
-             void *watcherCtx) {}
-
-int main(int argc, char argv) {
-  char buffer[512];
-  char p[2048];
-  char *cert=0;
-  char appId[64];
-
-  strcpy(appId, "example.foo_test");
-  cert = foo_get_cert_once(appId);
-  if(cert!=0) {
-    fprintf(stderr,
-            "Certificate for appid [%s] is [%s]\n",appId,cert);
-    strncpy(p,cert, sizeof(p)-1);
-    free(cert);
-  } else {
-    fprintf(stderr, "Certificate for appid [%s] not found\n",appId);
-    strcpy(p, "dummy");
-  }
-
-  zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
-
-  zh = zookeeper_init("localhost:3181", watcher, 10000, 0, 0, 0);
-  if (!zh) {
-    return errno;
-  }
-  if(zoo_add_auth(zh,"foo",p,strlen(p),0,0)!=ZOK)
-    return 2;
-
-  struct ACL CREATE_ONLY_ACL[] = {{ZOO_PERM_CREATE, ZOO_AUTH_IDS}};
-  struct ACL_vector CREATE_ONLY = {1, CREATE_ONLY_ACL};
-  int rc = zoo_create(zh,"/xyz","value", 5, &amp;CREATE_ONLY, ZOO_EPHEMERAL,
-                      buffer, sizeof(buffer)-1);
-
-  /** this operation will fail with a ZNOAUTH error */
-  int buflen= sizeof(buffer);
-  struct Stat stat;
-  rc = zoo_get(zh, "/xyz", 0, buffer, &amp;buflen, &amp;stat);
-  if (rc) {
-    fprintf(stderr, "Error %d for %s\n", rc, __LINE__);
-  }
-
-  zookeeper_close(zh);
-  return 0;
-}
-      </programlisting>
-    </section>
-    </section>
-  </section>
-
-  <section id="sc_ZooKeeperPluggableAuthentication">
-    <title>Pluggable ZooKeeper authentication</title>
-
-    <para>ZooKeeper runs in a variety of different environments with
-    various different authentication schemes, so it has a completely
-    pluggable authentication framework. Even the builtin authentication
-    schemes use the pluggable authentication framework.</para>
-
-    <para>To understand how the authentication framework works, first you must
-    understand the two main authentication operations. The framework 
-    first must authenticate the client. This is usually done as soon as
-    the client connects to a server and consists of validating information
-    sent from or gathered about a client and associating it with the connection.
-    The second operation handled by the framework is finding the entries in an
-    ACL that correspond to client. ACL entries are &lt;<emphasis>idspec, 
-    permissions</emphasis>&gt; pairs. The <emphasis>idspec</emphasis> may be
-    a simple string match against the authentication information associated
-    with the connection or it may be a expression that is evaluated against that
-    information. It is up to the implementation of the authentication plugin
-    to do the match. Here is the interface that an authentication plugin must
-    implement:</para>
-
-    <programlisting>
-public interface AuthenticationProvider {
-    String getScheme();
-    KeeperException.Code handleAuthentication(ServerCnxn cnxn, byte authData[]);
-    boolean isValid(String id);
-    boolean matches(String id, String aclExpr);
-    boolean isAuthenticated();
-}
-    </programlisting>
-
-    <para>The first method <emphasis>getScheme</emphasis> returns the string
-    that identifies the plugin. Because we support multiple methods of authentication,
-    an authentication credential or an <emphasis>idspec</emphasis> will always be
-    prefixed with <emphasis>scheme:</emphasis>. The ZooKeeper server uses the scheme
-    returned by the authentication plugin to determine which ids the scheme
-    applies to.</para>
-
-    <para><emphasis>handleAuthentication</emphasis> is called when a client
-    sends authentication information to be associated with a connection. The
-    client specifies the scheme to which the information corresponds. The
-    ZooKeeper server passes the information to the authentication plugin whose
-    <emphasis>getScheme</emphasis> matches the scheme passed by the client. The
-    implementor of <emphasis>handleAuthentication</emphasis> will usually return
-    an error if it determines that the information is bad, or it will associate information
-    with the connection using <emphasis>cnxn.getAuthInfo().add(new Id(getScheme(), data))</emphasis>.
-    </para>
-
-    <para>The authentication plugin is involved in both setting and using ACLs. When an
-    ACL is set for a znode, the ZooKeeper server will pass the id part of the entry to
-    the <emphasis>isValid(String id)</emphasis> method. It is up to the plugin to verify
-    that the id has a correct form. For example, <emphasis>ip:172.16.0.0/16</emphasis>
-    is a valid id, but <emphasis>ip:host.com</emphasis> is not. If the new ACL includes
-    an "auth" entry, <emphasis>isAuthenticated</emphasis> is used to see if the 
-    authentication information for this scheme that is assocatied with the connection
-    should be added to the ACL. Some schemes
-    should not be included in auth. For example, the IP address of the client is not
-    considered as an id that should be added to the ACL if auth is specified.</para>
-
-    <para>ZooKeeper invokes
-    <emphasis>matches(String id, String aclExpr)</emphasis> when checking an ACL. It
-    needs to match authentication information of the client against the relevant ACL
-    entries. To find the entries which apply to the client, the ZooKeeper server will
-    find the scheme of each entry and if there is authentication information
-    from that client for that scheme, <emphasis>matches(String id, String aclExpr)</emphasis>
-    will be called with <emphasis>id</emphasis> set to the authentication information
-    that was previously added to the connection by <emphasis>handleAuthentication</emphasis> and
-    <emphasis>aclExpr</emphasis> set to the id of the ACL entry. The authentication plugin
-    uses its own logic and matching scheme to determine if <emphasis>id</emphasis> is included
-    in <emphasis>aclExpr</emphasis>. 
-    </para>
-
-    <para>There are two built in authentication plugins: <emphasis>ip</emphasis> and
-    <emphasis>digest</emphasis>. Additional plugins can adding using system properties. At
-    startup the ZooKeeper server will look for system properties that start with
-    "zookeeper.authProvider." and interpret the value of those properties as the class name
-    of an authentication plugin. These properties can be set using the
-    <emphasis>-Dzookeeeper.authProvider.X=com.f.MyAuth</emphasis> or adding entries such as
-    the following in the server configuration file:</para>
-
-    <programlisting>
-authProvider.1=com.f.MyAuth
-authProvider.2=com.f.MyAuth2
-    </programlisting>
- 
-    <para>Care should be taking to ensure that the suffix on the property is unique. If there are 
-    duplicates such as <emphasis>-Dzookeeeper.authProvider.X=com.f.MyAuth -Dzookeeper.authProvider.X=com.f.MyAuth2</emphasis>,
-    only one will be used. Also all servers must have the same plugins defined, otherwise clients using
-    the authentication schemes provided by the plugins will have problems connecting to some servers.
-    </para>
-
-    <para> <emphasis role="bold">Added in 3.6.0</emphasis>: An alternate abstraction is available for pluggable
-    authentication. It provides additional arguments.
-    </para>
-
-    <programlisting>
-public abstract class ServerAuthenticationProvider implements AuthenticationProvider {
-    public abstract KeeperException.Code handleAuthentication(ServerObjs serverObjs, byte authData[]);
-    public abstract boolean matches(ServerObjs serverObjs, MatchValues matchValues);
-}
-    </programlisting>
-
-    <para>
-    Instead of implementing AuthenticationProvider you extend ServerAuthenticationProvider. Your handleAuthentication()
-    and matches() methods will then receive the additional parameters (via ServerObjs and MatchValues).
-    </para>
-
-    <itemizedlist>
-      <listitem>
-        <para><emphasis role="bold">ZooKeeperServer</emphasis></para>
-
-        <para>The ZooKeeperServer instance</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">ServerCnxn</emphasis></para>
-
-        <para>The current connection</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">path</emphasis></para>
-
-        <para>The ZNode path being operated on (or null if not used)</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">perm</emphasis></para>
-
-        <para>The operation value or 0</para>
-      </listitem>
-
-      <listitem>
-        <para><emphasis role="bold">setAcls</emphasis></para>
-
-        <para>When the setAcl() method is being operated on, the list of ACLs that are being set</para>
-      </listitem>
-    </itemizedlist>
-  </section>
-      
-  <section id="ch_zkGuarantees">
-    <title>Consistency Guarantees</title>
-
-    <para>ZooKeeper is a high performance, scalable service. Both reads and
-    write operations are designed to be fast, though reads are faster than
-    writes. The reason for this is that in the case of reads, ZooKeeper can
-    serve older data, which in turn is due to ZooKeeper's consistency
-    guarantees:</para>
-
-    <variablelist>
-      <varlistentry>
-        <term>Sequential Consistency</term>
-
-        <listitem>
-          <para>Updates from a client will be applied in the order that they
-          were sent.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term>Atomicity</term>
-
-        <listitem>
-          <para>Updates either succeed or fail -- there are no partial
-          results.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term>Single System Image</term>
-
-        <listitem>
-          <para>A client will see the same view of the service regardless of
-          the server that it connects to.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term>Reliability</term>
-
-        <listitem>
-          <para>Once an update has been applied, it will persist from that
-          time forward until a client overwrites the update. This guarantee
-          has two corollaries:</para>
-
-          <orderedlist>
-            <listitem>
-              <para>If a client gets a successful return code, the update will
-              have been applied. On some failures (communication errors,
-              timeouts, etc) the client will not know if the update has
-              applied or not. We take steps to minimize the failures, but the
-              guarantee is only present with successful return codes.
-              (This is called the <emphasis>monotonicity condition</emphasis> in Paxos.)</para>
-            </listitem>
-
-            <listitem>
-              <para>Any updates that are seen by the client, through a read
-              request or successful update, will never be rolled back when
-              recovering from server failures.</para>
-            </listitem>
-          </orderedlist>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term>Timeliness</term>
-
-        <listitem>
-          <para>The clients view of the system is guaranteed to be up-to-date
-          within a certain time bound (on the order of tens of seconds).
-          Either system changes will be seen by a client within this bound, or
-          the client will detect a service outage.</para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-
-    <para>Using these consistency guarantees it is easy to build higher level
-    functions such as leader election, barriers, queues, and read/write
-    revocable locks solely at the ZooKeeper client (no additions needed to
-    ZooKeeper). See <ulink url="recipes.html">Recipes and Solutions</ulink>
-    for more details.</para>
-
-    <note>
-        <para>Sometimes developers mistakenly assume one other guarantee that
-        ZooKeeper does <emphasis>not</emphasis> in fact make. This is:</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>Simultaneously Consistent Cross-Client Views</term>
-
-            <listitem>
-              <para>ZooKeeper does not guarantee that at every instance in
-              time, two different clients will have identical views of
-              ZooKeeper data. Due to factors like network delays, one client
-              may perform an update before another client gets notified of the
-              change. Consider the scenario of two clients, A and B. If client
-              A sets the value of a znode /a from 0 to 1, then tells client B
-              to read /a, client B may read the old value of 0, depending on
-              which server it is connected to. If it
-              is important that Client A and Client B read the same value,
-              Client B should should call the <emphasis
-              role="bold">sync()</emphasis> method from the ZooKeeper API
-              method before it performs its read.</para>
-
-              <para>So, ZooKeeper by itself doesn't guarantee that changes occur 
-              synchronously across all servers, but ZooKeeper
-              primitives can be used to construct higher level functions that
-              provide useful client synchronization. (For more information,
-              see the <ulink
-              url="recipes.html">ZooKeeper Recipes</ulink>.
-              <emphasis>[tbd:..]</emphasis>).</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </note>
-  </section>
-
-  <section id="ch_bindings">
-    <title>Bindings</title>
-
-    <para>The ZooKeeper client libraries come in two languages: Java and C.
-    The following sections describe these.</para>
-
-    <section>
-      <title>Java Binding</title>
-
-      <para>There are two packages that make up the ZooKeeper Java binding:
-      <emphasis role="bold">org.apache.zookeeper</emphasis> and <emphasis
-      role="bold">org.apache.zookeeper.data</emphasis>. The rest of the
-      packages that make up ZooKeeper are used internally or are part of the
-      server implementation. The <emphasis
-      role="bold">org.apache.zookeeper.data</emphasis> package is made up of
-      generated classes that are used simply as containers.</para>
-
-      <para>The main class used by a ZooKeeper Java client is the <emphasis
-      role="bold">ZooKeeper</emphasis> class. Its two constructors differ only
-      by an optional session id and password. ZooKeeper supports session
-      recovery accross instances of a process. A Java program may save its
-      session id and password to stable storage, restart, and recover the
-      session that was used by the earlier instance of the program.</para>
-
-      <para>When a ZooKeeper object is created, two threads are created as
-      well: an IO thread and an event thread. All IO happens on the IO thread
-      (using Java NIO). All event callbacks happen on the event thread.
-      Session maintenance such as reconnecting to ZooKeeper servers and
-      maintaining heartbeat is done on the IO thread. Responses for
-      synchronous methods are also processed in the IO thread. All responses
-      to asynchronous methods and watch events are processed on the event
-      thread. There are a few things to notice that result from this
-      design:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>All completions for asynchronous calls and watcher callbacks
-          will be made in order, one at a time. The caller can do any
-          processing they wish, but no other callbacks will be processed
-          during that time.</para>
-        </listitem>
-
-        <listitem>
-          <para>Callbacks do not block the processing of the IO thread or the
-          processing of the synchronous calls.</para>
-        </listitem>
-
-        <listitem>
-          <para>Synchronous calls may not return in the correct order. For
-          example, assume a client does the following processing: issues an
-          asynchronous read of node <emphasis role="bold">/a</emphasis> with
-          <emphasis>watch</emphasis> set to true, and then in the completion
-          callback of the read it does a synchronous read of <emphasis
-          role="bold">/a</emphasis>. (Maybe not good practice, but not illegal
-          either, and it makes for a simple example.)</para>
-
-          <para>Note that if there is a change to <emphasis
-          role="bold">/a</emphasis> between the asynchronous read and the
-          synchronous read, the client library will receive the watch event
-          saying <emphasis role="bold">/a</emphasis> changed before the
-          response for the synchronous read, but because the completion
-          callback is blocking the event queue, the synchronous read will
-          return with the new value of <emphasis role="bold">/a</emphasis>
-          before the watch event is processed.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>Finally, the rules associated with shutdown are straightforward:
-      once a ZooKeeper object is closed or receives a fatal event
-      (SESSION_EXPIRED and AUTH_FAILED), the ZooKeeper object becomes invalid.
-      On a close, the two threads shut down and any further access on zookeeper
-      handle is undefined behavior and should be avoided. </para>
-      <section id="sc_java_client_configuration">
-        <title><emphasis role="bold">Client Configuration Parameters</emphasis></title>
-        <para>
-            The following list contains configuration properties for the Java client. You can set any
-            of these properties using Java system properties. For server properties, please check the
-            following reference
-            <ulink url="zookeeperAdmin.html#sc_configuration">Server configuration section.</ulink>
-        </para>
-        <variablelist>
-            <varlistentry>
-                <term>zookeeper.sasl.client</term>
-                <listitem>
-                    <para>Set the value to <emphasis role="bold">false</emphasis> to disable
-                    SASL authentication. Default is <emphasis role="bold">true</emphasis>.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.sasl.clientconfig</term>
-                <listitem>
-                    <para>Specifies the context key in the JAAS login file. Default is "Client".</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.sasl.client.username</term>
-                <listitem>
-                    <para>Traditionally, a principal is divided into three parts: the primary, the instance, and the realm.
-                        The format of a typical Kerberos V5 principal is primary/instance@REALM.
-                        zookeeper.sasl.client.username specifies the primary part of the server principal. Default
-                        is "zookeeper". Instance part is derived from the server IP. Finally server's principal is
-                        username/IP@realm, where username is the value of zookeeper.sasl.client.username, IP is
-                        the server IP, and realm is the value of zookeeper.server.realm.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.server.realm</term>
-                <listitem>
-                    <para>Realm part of the server principal. By default it is the client principal realm.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.disableAutoWatchReset</term>
-                <listitem>
-                    <para>This switch controls whether automatic watch resetting is enabled. Clients automatically
-                        reset watches during session reconnect by default, this option allows the client to turn off
-                        this behavior by setting zookeeper.disableAutoWatchReset to <emphasis role="bold">true</emphasis>. 
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.client.secure</term>
-                <listitem>
-                    <para>
-                        If you want to connect to the server secure client port, you need to set this property to
-                        <emphasis role="bold">true</emphasis>
-                        on the client. This will connect to server using SSL with specified credentials. Note that
-                        it requires the Netty client.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.clientCnxnSocket</term>
-                <listitem>
-                    <para>
-                        Specifies which ClientCnxnSocket to be used. Possible values are
-                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNIO</emphasis>
-                        and
-                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>
-                        . Default is
-                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNIO</emphasis>
-                        . If you want to connect to server's secure client port, you need to set this property to
-                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>
-                        on client.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.ssl.keyStore.location and zookeeper.ssl.keyStore.password</term>
-                <listitem>
-                    <para>Specifies the file path to a JKS containing the local credentials to be used for SSL connections,
-                        and the password to unlock the file.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.ssl.trustStore.location and zookeeper.ssl.trustStore.password</term>
-                <listitem>
-                    <para>Specifies the file path to a JKS containing the remote credentials to be used for SSL connections,
-                        and the password to unlock the file.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>jute.maxbuffer</term>
-                <listitem>
-                    <para>It specifies the maximum size of the incoming data from the server. The default value is 4194304
-                        Bytes , or just 4 MB. This is really a sanity check. The ZooKeeper server is designed to store and send
-                        data on the order of kilobytes. If incoming data length is more than this value, an IOException
-                        is raised.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>zookeeper.kinit</term>
-                <listitem>
-                    <para>Specifies path to kinit binary. Default is "/usr/bin/kinit".</para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </section>
-    </section>
-
-    <section>
-      <title>C Binding</title>
-
-      <para>The C binding has a single-threaded and multi-threaded library.
-      The multi-threaded library is easiest to use and is most similar to the
-      Java API. This library will create an IO thread and an event dispatch
-      thread for handling connection maintenance and callbacks. The
-      single-threaded library allows ZooKeeper to be used in event driven
-      applications by exposing the event loop used in the multi-threaded
-      library.</para>
-
-      <para>The package includes two shared libraries: zookeeper_st and
-      zookeeper_mt. The former only provides the asynchronous APIs and
-      callbacks for integrating into the application's event loop. The only
-      reason this library exists is to support the platforms were a
-      <emphasis>pthread</emphasis> library is not available or is unstable
-      (i.e. FreeBSD 4.x). In all other cases, application developers should
-      link with zookeeper_mt, as it includes support for both Sync and Async
-      API.</para>
-
-      <section>
-        <title>Installation</title>
-
-        <para>If you're building the client from a check-out from the Apache
-        repository, follow the steps outlined below. If you're building from a
-        project source package downloaded from apache, skip to step <emphasis
-        role="bold">3</emphasis>.</para>
-
-        <orderedlist>
-          <listitem>
-            <para>Run <command>ant compile_jute</command> from the ZooKeeper
-            top level directory (<filename>.../trunk</filename>).
-            This will create a directory named "generated" under
-            <filename>.../trunk/src/c</filename>.</para>
-          </listitem>
-
-          <listitem>
-            <para>Change directory to the<filename>.../trunk/src/c</filename>
-            and run <command>autoreconf -if</command> to bootstrap <emphasis
-            role="bold">autoconf</emphasis>, <emphasis
-            role="bold">automake</emphasis> and <emphasis
-            role="bold">libtool</emphasis>. Make sure you have <emphasis
-            role="bold">autoconf version 2.59</emphasis> or greater installed.
-            Skip to step<emphasis role="bold"> 4</emphasis>.</para>
-          </listitem>
-
-          <listitem>
-            <para>If you are building from a project source package,
-            unzip/untar the source tarball and cd to the<filename>
-            zookeeper-x.x.x/src/c</filename> directory.</para>
-          </listitem>
-
-          <listitem>
-            <para>Run <command>./configure &lt;your-options&gt;</command> to
-            generate the makefile. Here are some of options the <emphasis
-            role="bold">configure</emphasis> utility supports that can be
-            useful in this step:</para>
-
-            <itemizedlist>
-              <listitem>
-                <para><command>--enable-debug</command></para>
-
-                <para>Enables optimization and enables debug info compiler
-                options. (Disabled by default.)</para>
-              </listitem>
-
-              <listitem>
-                <para><command>--without-syncapi </command></para>
-
-                <para>Disables Sync API support; zookeeper_mt library won't be
-                built. (Enabled by default.)</para>
-              </listitem>
-
-              <listitem>
-                <para><command>--disable-static </command></para>
-
-                <para>Do not build static libraries. (Enabled by
-                default.)</para>
-              </listitem>
-
-              <listitem>
-                <para><command>--disable-shared</command></para>
-
-                <para>Do not build shared libraries. (Enabled by
-                default.)</para>
-              </listitem>
-            </itemizedlist>
-
-            <note>
-              <para>See INSTALL for general information about running
-              <emphasis role="bold">configure</emphasis>.</para>
-            </note>
-          </listitem>
-
-          <listitem>
-            <para>Run <command>make</command> or <command>make
-            install</command> to build the libraries and install them.</para>
-          </listitem>
-
-          <listitem>
-            <para>To generate doxygen documentation for the ZooKeeper API, run
-            <command>make doxygen-doc</command>. All documentation will be
-            placed in a new subfolder named docs. By default, this command
-            only generates HTML. For information on other document formats,
-            run <command>./configure --help</command></para>
-          </listitem>
-        </orderedlist>
-      </section>
-
-      <section>
-        <title>Building Your Own C Client</title>
-
-        <para>In order to be able to use the ZooKeeper C API in your application
-        you have to remember to</para>
-
-        <orderedlist>
-          <listitem>
-            <para>Include ZooKeeper header: #include
-              &lt;zookeeper/zookeeper.h&gt;</para>
-          </listitem>
-
-          <listitem>
-            <para>If you are building a multithreaded client, compile with
-            -DTHREADED compiler flag to enable the multi-threaded version of
-            the library, and then link against against the
-            <emphasis>zookeeper_mt</emphasis> library. If you are building a
-            single-threaded client, do not compile with -DTHREADED, and be
-            sure to link against the<emphasis> zookeeper_st
-            </emphasis>library.</para>
-          </listitem>
-        </orderedlist>
-
-        <note><para>See <filename>.../trunk/src/c/src/cli.c</filename>
-          for an example of a C client implementation</para>
-        </note>
-      </section>
-    </section>
-  </section>
-
-   <section id="ch_guideToZkOperations">
-    <title>Building Blocks: A Guide to ZooKeeper Operations</title>
-
-    <para>This section surveys all the operations a developer can perform
-    against a ZooKeeper server. It is lower level information than the earlier
-    concepts chapters in this manual, but higher level than the ZooKeeper API
-    Reference. It covers these topics:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para><xref linkend="sc_connectingToZk" /></para>
-      </listitem>
-    </itemizedlist>
-
-    <section id="sc_errorsZk">
-      <title>Handling Errors</title>
-
-      <para>Both the Java and C client bindings may report errors. The Java client binding does so by throwing KeeperException, calling code() on the exception will return the specific error code. The C client binding returns an error code as defined in the enum ZOO_ERRORS. API callbacks indicate result code for both language bindings. See the API documentation (javadoc for Java, doxygen for C) for full details on the possible errors and their meaning.</para>
-    </section>
-    
-    <section id="sc_connectingToZk">
-      <title>Connecting to ZooKeeper</title>
-
-      <para>Before we begin, you will have to set up a running Zookeeper server so that we can start developing the client. For C client bindings, we will be using the multithreaded library(zookeeper_mt) with a simple example written in C. To establish a connection with Zookeeper server, we make use of C API - <emphasis>zookeeper_init</emphasis> with the following signature:</para>
-
-      <programlisting><emphasis>int</emphasis> <emphasis>zookeeper_init</emphasis>(<emphasis>const</emphasis> <emphasis>char</emphasis> *host, watcher_fn fn, <emphasis>int</emphasis> recv_timeout, <emphasis>const</emphasis> clientid_t *clientid, <emphasis>void</emphasis> *context, <emphasis>int</emphasis> flags);</programlisting>
-
-      <variablelist>
-        <varlistentry>
-          <term>*host</term>
-            <listitem>
-              <para>Connection string to zookeeper server in the format of host:port. If there are multiple servers, use comma as separator after specifying the host:port pairs. Eg: "127.0.0.1:2181,127.0.0.1:3001,127.0.0.1:3002"</para>
-            </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>fn</term>
-          <listitem>
-              <para>Watcher function to process events when a notification is triggered.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>recv_timeout</term>
-          <listitem>
-              <para>Session expiration time in milliseconds.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>*clientid</term>
-          <listitem>
-              <para>We can specify 0 for a new session. If a session has already establish previously, we could provide that client ID and it would reconnect to that previous session.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>*context</term>
-          <listitem>
-              <para>Context object that can be associated with the zkhandle_t handler. If it is not used, we can set it to 0.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>flags</term>
-          <listitem>
-              <para>In an initiation, we can leave it for 0.</para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-
-      <para>We will demonstrate client that outputs "Connected to Zookeeper" after successful connection or an error message otherwise. Let's call the following code <emphasis>zkClient.cc</emphasis> :</para>
-      <programlisting>
-#include &lt;stdio.h>
-#include &lt;zookeeper/zookeeper.h>
-#include &lt;errno.h>
-using namespace std;
-
-// Keeping track of the connection state
-static int connected = 0;
-static int expired   = 0;
-
-// *zkHandler handles the connection with Zookeeper
-static zhandle_t *zkHandler;
-
-// watcher function would process events
-void watcher(zhandle_t *zkH, int type, int state, const char *path, void *watcherCtx)
-{
-    if (type == ZOO_SESSION_EVENT) {
-
-        // state refers to states of zookeeper connection.
-        // To keep it simple, we would demonstrate these 3: ZOO_EXPIRED_SESSION_STATE, ZOO_CONNECTED_STATE, ZOO_NOTCONNECTED_STATE
-        // If you are using ACL, you should be aware of an authentication failure state - ZOO_AUTH_FAILED_STATE
-        if (state == ZOO_CONNECTED_STATE) {
-            connected = 1;
-        } else if (state == ZOO_NOTCONNECTED_STATE ) {
-            connected = 0;
-        } else if (state == ZOO_EXPIRED_SESSION_STATE) {
-            expired = 1;
-            connected = 0;
-            zookeeper_close(zkH);
-        }
-    }
-}
-
-int main(){
-    zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
-
-    // zookeeper_init returns the handler upon a successful connection, null otherwise
-    zkHandler = zookeeper_init("localhost:2181", watcher, 10000, 0, 0, 0);
-    
-    if (!zkHandler) {
-        return errno;
-    }else{
-        printf("Connection established with Zookeeper. \n");
-    }
-
-    // Close Zookeeper connection
-    zookeeper_close(zkHandler);
-
-    return 0;
-}
-      </programlisting>
-
-      <para>Compile the code with the multithreaded library mentioned before.</para>
-      <para><command>&gt; g++ -Iinclude/ zkClient.cpp -lzookeeper_mt -o Client</command></para>
-
-      <para>Run the client. </para>
-      <para><command>&gt; ./Client</command></para>
-
-      <para>From the output, you should see "Connected to Zookeeper" along with Zookeeper's DEBUG messages if the connection is successful.</para>
-
-    </section>
-    
-    <section id="sc_readOps">
-      <title>Read Operations</title>
-
-      <para></para>
-    </section>
-    
-    <section id="sc_writeOps">
-      <title>Write Operations</title>
-
-      <para></para>
-    </section>
-    
-    <section id="sc_handlingWatches">
-      <title>Handling Watches</title>
-
-      <para></para>
-    </section>
-    
-    <section id="sc_miscOps">
-      <title>Miscelleaneous ZooKeeper Operations</title>
-      <para></para>
-    </section>
-    
-
-  </section>
-
-  <section id="ch_programStructureWithExample">
-    <title>Program Structure, with Simple Example</title>
-
-    <para><emphasis>[tbd]</emphasis></para>
-  </section>
-
-  <section id="ch_gotchas">
-    <title>Gotchas: Common Problems and Troubleshooting</title>
-
-    <para>So now you know ZooKeeper. It's fast, simple, your application
-    works, but wait ... something's wrong. Here are some pitfalls that
-    ZooKeeper users fall into:</para>
-
-    <orderedlist>
-      <listitem>
-        <para>If you are using watches, you must look for the connected watch
-        event. When a ZooKeeper client disconnects from a server, you will
-        not receive notification of changes until reconnected. If you are
-        watching for a znode to come into existence, you will miss the event
-        if the znode is created and deleted while you are disconnected.</para>
-      </listitem>
-
-      <listitem>
-        <para>You must test ZooKeeper server failures. The ZooKeeper service
-        can survive failures as long as a majority of servers are active. The
-        question to ask is: can your application handle it? In the real world
-        a client's connection to ZooKeeper can break. (ZooKeeper server
-        failures and network partitions are common reasons for connection
-        loss.) The ZooKeeper client library takes care of recovering your
-        connection and letting you know what happened, but you must make sure
-        that you recover your state and any outstanding requests that failed.
-        Find out if you got it right in the test lab, not in production - test
-        with a ZooKeeper service made up of a several of servers and subject

<TRUNCATED>

[06/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/javaExample.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/javaExample.xml b/zookeeper-docs/src/documentation/content/xdocs/javaExample.xml
new file mode 100644
index 0000000..16f7795
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/javaExample.xml
@@ -0,0 +1,664 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="ar_JavaExample">
+  <title>ZooKeeper Java Example</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This article contains sample Java code for a simple watch client.</para>
+
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_Introduction">
+    <title>A Simple Watch Client</title>
+
+    <para>To introduce you to the ZooKeeper Java API, we develop here a very simple 
+    watch client. This ZooKeeper client watches a ZooKeeper node for changes 
+    and responds to by starting or stopping a program.</para>
+    
+    <section id="sc_requirements"><title>Requirements</title>
+    
+    <para>The client has four requirements:</para>
+    
+    <itemizedlist><listitem><para>It takes as parameters:</para>
+        <itemizedlist>
+        <listitem><para>the address of the ZooKeeper service</para></listitem>
+        <listitem><para>the name of a znode - the one to be watched</para></listitem>
+        <listitem><para>the name of a file to write the output to</para></listitem>
+        <listitem><para>an executable with arguments.</para></listitem></itemizedlist></listitem>
+    <listitem><para>It fetches the data associated with the znode and starts the executable.</para></listitem>
+    <listitem><para>If the znode changes, the client refetches the contents and restarts the executable.</para></listitem>
+    <listitem><para>If the znode disappears, the client kills the executable.</para></listitem></itemizedlist>
+
+   </section>
+   
+   <section id="sc_design">
+   	<title>Program Design</title>
+
+   <para>Conventionally, ZooKeeper applications are broken into two units, one which maintains the connection, 
+   and the other which monitors data.  In this application, the class called the <emphasis role="bold">Executor</emphasis> 
+   maintains the ZooKeeper connection, and the class called the  <emphasis role="bold">DataMonitor</emphasis> monitors the data
+   in the ZooKeeper tree. Also, Executor contains the main thread and contains the execution logic.
+   It is responsible for what little user interaction there is, as well as interaction with the exectuable program you
+   pass in as an argument and which the sample (per the requirements) shuts down and restarts, according to the 
+   state of the znode.</para>
+   
+   </section>
+  
+   </section>
+
+   <section id="sc_executor"><title>The Executor Class</title>
+    <para>The Executor object is the primary container of the sample application. It contains 
+    both the <emphasis role="bold">ZooKeeper</emphasis> object, <emphasis role="bold">DataMonitor</emphasis>, as described above in 
+    <xref linkend="sc_design"/>.  </para>
+    
+    <programlisting>
+    // from the Executor class...
+    
+    public static void main(String[] args) {
+        if (args.length &lt; 4) {
+            System.err
+                    .println("USAGE: Executor hostPort znode filename program [args ...]");
+            System.exit(2);
+        }
+        String hostPort = args[0];
+        String znode = args[1];
+        String filename = args[2];
+        String exec[] = new String[args.length - 3];
+        System.arraycopy(args, 3, exec, 0, exec.length);
+        try {
+            new Executor(hostPort, znode, filename, exec).run();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public Executor(String hostPort, String znode, String filename,
+            String exec[]) throws KeeperException, IOException {
+        this.filename = filename;
+        this.exec = exec;
+        zk = new ZooKeeper(hostPort, 3000, this);
+        dm = new DataMonitor(zk, znode, null, this);
+    }
+
+    public void run() {
+        try {
+            synchronized (this) {
+                while (!dm.dead) {
+                    wait();
+                }
+            }
+        } catch (InterruptedException e) {
+        }
+    }
+</programlisting>
+
+
+    <para>
+    Recall that the Executor's job is to start and stop the executable whose name you pass in on the command line. 
+    It does this in response to events fired by the ZooKeeper object. As you can see in the code above, the Executor passes
+    a reference to itself as the Watcher argument in the ZooKeeper constructor. It also passes a reference to itself
+    as DataMonitorListener argument to the DataMonitor constructor. Per the Executor's definition, it implements both these
+    interfaces:
+    </para>
+    
+    <programlisting>
+public class Executor implements Watcher, Runnable, DataMonitor.DataMonitorListener {
+...</programlisting>
+    
+    <para>The <emphasis role="bold">Watcher</emphasis> interface is defined by the ZooKeeper Java API.
+    ZooKeeper uses it to communicate back to its container. It supports only one method, <command>process()</command>, and ZooKeeper uses 
+    it to communciates generic events that the main thread would be intersted in, such as the state of the ZooKeeper connection or the ZooKeeper session.The Executor 
+    in this example simply forwards those events down to the DataMonitor to decide what to do with them. It does this simply to illustrate
+    the point that, by convention, the Executor or some Executor-like object "owns" the ZooKeeper connection, but it is free to delegate the events to other
+    events to other objects. It also uses this as the default channel on which to fire watch events. (More on this later.)</para>
+    
+<programlisting>
+    public void process(WatchedEvent event) {
+        dm.process(event);
+    }
+</programlisting>
+    
+    <para>The <emphasis role="bold">DataMonitorListener</emphasis> 
+    interface, on the other hand, is not part of the the ZooKeeper API. It is a completely custom interface, 
+    designed for this sample application. The DataMonitor object uses it to communicate back to its container, which
+    is also the the Executor object.The DataMonitorListener interface looks like this:</para>
+    <programlisting>
+public interface DataMonitorListener {
+    /**
+    * The existence status of the node has changed.
+    */
+    void exists(byte data[]);
+
+    /**
+    * The ZooKeeper session is no longer valid.
+    * 
+    * @param rc
+    * the ZooKeeper reason code
+    */
+    void closing(int rc);
+}
+</programlisting>
+    <para>This interface is defined in the DataMonitor class and implemented in the Executor class. 
+    When <command>Executor.exists()</command> is invoked,
+    the Executor decides whether to start up or shut down per the requirements. Recall that the requires say to kill the executable when the 
+    znode ceases to <emphasis>exist</emphasis>. </para>
+    
+    <para>When <command>Executor.closing()</command>
+    is invoked, the Executor decides whether or not to shut itself down in response to the ZooKeeper connection permanently disappearing.</para>
+    
+    <para>As you might have guessed, DataMonitor is the object that invokes 
+    these methods, in response to changes in ZooKeeper's state.</para>
+    
+    <para>Here are Executor's implementation of 
+    <command>DataMonitorListener.exists()</command> and <command>DataMonitorListener.closing</command>:
+    </para>
+    <programlisting>
+public void exists( byte[] data ) {
+    if (data == null) {
+        if (child != null) {
+            System.out.println("Killing process");
+            child.destroy();
+            try {
+                child.waitFor();
+            } catch (InterruptedException e) {
+            }
+        }
+        child = null;
+    } else {
+        if (child != null) {
+            System.out.println("Stopping child");
+            child.destroy();
+            try {
+               child.waitFor();
+            } catch (InterruptedException e) {
+            e.printStackTrace();
+            }
+        }
+        try {
+            FileOutputStream fos = new FileOutputStream(filename);
+            fos.write(data);
+            fos.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        try {
+            System.out.println("Starting child");
+            child = Runtime.getRuntime().exec(exec);
+            new StreamWriter(child.getInputStream(), System.out);
+            new StreamWriter(child.getErrorStream(), System.err);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}
+
+public void closing(int rc) {
+    synchronized (this) {
+        notifyAll();
+    }
+}
+</programlisting>
+    
+</section>
+<section id="sc_DataMonitor"><title>The DataMonitor Class</title>
+<para>
+The DataMonitor class has the meat of the ZooKeeper logic. It is mostly 
+asynchronous and event driven. DataMonitor kicks things off in the constructor with:</para>
+<programlisting>
+public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher,
+        DataMonitorListener listener) {
+    this.zk = zk;
+    this.znode = znode;
+    this.chainedWatcher = chainedWatcher;
+    this.listener = listener;
+    
+    // Get things started by checking if the node exists. We are going
+    // to be completely event driven
+    <emphasis role="bold">zk.exists(znode, true, this, null);</emphasis>
+}
+</programlisting>
+
+<para>The call to <command>ZooKeeper.exists()</command> checks for the existence of the znode, 
+sets a watch, and passes a reference to itself (<command>this</command>)
+as the completion callback object. In this sense, it kicks things off, since the
+real processing happens when the watch is triggered.</para>
+
+<note>
+<para>Don't confuse the completion callback with the watch callback. The <command>ZooKeeper.exists()</command> 
+completion callback, which happens to be the method <command>StatCallback.processResult()</command> implemented 
+in the DataMonitor object, is invoked when the asynchronous <emphasis>setting of the watch</emphasis> operation 
+(by <command>ZooKeeper.exists()</command>) completes on the server. </para>
+<para>
+The triggering of the watch, on the other hand, sends an event to the <emphasis>Executor</emphasis> object, since
+the Executor registered as the Watcher of the ZooKeeper object.</para>
+
+<para>As an aside, you might note that the DataMonitor could also register itself as the Watcher
+for this particular watch event. This is new to ZooKeeper 3.0.0 (the support of multiple Watchers). In this
+example, however, DataMonitor does not register as the Watcher.</para>
+</note>
+
+<para>When the <command>ZooKeeper.exists()</command> operation completes on the server, the ZooKeeper API invokes this completion callback on 
+the client:</para>
+
+<programlisting>
+public void processResult(int rc, String path, Object ctx, Stat stat) {
+    boolean exists;
+    switch (rc) {
+    case Code.Ok:
+        exists = true;
+        break;
+    case Code.NoNode:
+        exists = false;
+        break;
+    case Code.SessionExpired:
+    case Code.NoAuth:
+        dead = true;
+        listener.closing(rc);
+        return;
+    default:
+        // Retry errors
+        zk.exists(znode, true, this, null);
+        return;
+    }
+ 
+    byte b[] = null;
+    if (exists) {
+        try {
+            <emphasis role="bold">b = zk.getData(znode, false, null);</emphasis>
+        } catch (KeeperException e) {
+            // We don't need to worry about recovering now. The watch
+            // callbacks will kick off any exception handling
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            return;
+        }
+    }     
+    if ((b == null &amp;&amp; b != prevData)
+            || (b != null &amp;&amp; !Arrays.equals(prevData, b))) {
+        <emphasis role="bold">listener.exists(b);</emphasis>
+        prevData = b;
+    }
+}
+</programlisting>
+
+<para>
+The code first checks the error codes for znode existence, fatal errors, and 
+recoverable errors. If the file (or znode) exists, it gets the data from the znode, and 
+then invoke the exists() callback of Executor if the state has changed. Note, 
+it doesn't have to do any Exception processing for the getData call because it 
+has watches pending for anything that could cause an error: if the node is deleted 
+before it calls <command>ZooKeeper.getData()</command>, the watch event set by 
+the <command>ZooKeeper.exists()</command> triggers a callback; 
+if there is a communication error, a connection watch event fires when 
+the connection comes back up.
+</para>
+
+<para>Finally, notice how DataMonitor processes watch events: </para>
+<programlisting>
+    public void process(WatchedEvent event) {
+        String path = event.getPath();
+        if (event.getType() == Event.EventType.None) {
+            // We are are being told that the state of the
+            // connection has changed
+            switch (event.getState()) {
+            case SyncConnected:
+                // In this particular example we don't need to do anything
+                // here - watches are automatically re-registered with 
+                // server and any watches triggered while the client was 
+                // disconnected will be delivered (in order of course)
+                break;
+            case Expired:
+                // It's all over
+                dead = true;
+                listener.closing(KeeperException.Code.SessionExpired);
+                break;
+            }
+        } else {
+            if (path != null &amp;&amp; path.equals(znode)) {
+                // Something has changed on the node, let's find out
+                zk.exists(znode, true, this, null);
+            }
+        }
+        if (chainedWatcher != null) {
+            chainedWatcher.process(event);
+        }
+    }
+</programlisting>
+<para>
+If the client-side ZooKeeper libraries can re-establish the
+communication channel (SyncConnected event) to ZooKeeper before
+session expiration (Expired event) all of the session's watches will
+automatically be re-established with the server (auto-reset of watches
+is new in ZooKeeper 3.0.0). See <ulink
+url="zookeeperProgrammers.html#ch_zkWatches">ZooKeeper Watches</ulink>
+in the programmer guide for more on this. A bit lower down in this
+function, when DataMonitor gets an event for a znode, it calls
+<command>ZooKeeper.exists()</command> to find out what has changed.
+</para>
+</section>
+
+<section id="sc_completeSourceCode">
+	<title>Complete Source Listings</title>
+	<example id="eg_Executor_java"><title>Executor.java</title><programlisting>
+/**
+ * A simple example program to use DataMonitor to start and
+ * stop executables based on a znode. The program watches the
+ * specified znode and saves the data that corresponds to the
+ * znode in the filesystem. It also starts the specified program
+ * with the specified arguments when the znode exists and kills
+ * the program if the znode goes away.
+ */
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+
+public class Executor
+    implements Watcher, Runnable, DataMonitor.DataMonitorListener
+{
+    String znode;
+
+    DataMonitor dm;
+
+    ZooKeeper zk;
+
+    String filename;
+
+    String exec[];
+
+    Process child;
+
+    public Executor(String hostPort, String znode, String filename,
+            String exec[]) throws KeeperException, IOException {
+        this.filename = filename;
+        this.exec = exec;
+        zk = new ZooKeeper(hostPort, 3000, this);
+        dm = new DataMonitor(zk, znode, null, this);
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        if (args.length &lt; 4) {
+            System.err
+                    .println("USAGE: Executor hostPort znode filename program [args ...]");
+            System.exit(2);
+        }
+        String hostPort = args[0];
+        String znode = args[1];
+        String filename = args[2];
+        String exec[] = new String[args.length - 3];
+        System.arraycopy(args, 3, exec, 0, exec.length);
+        try {
+            new Executor(hostPort, znode, filename, exec).run();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /***************************************************************************
+     * We do process any events ourselves, we just need to forward them on.
+     *
+     * @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.proto.WatcherEvent)
+     */
+    public void process(WatchedEvent event) {
+        dm.process(event);
+    }
+
+    public void run() {
+        try {
+            synchronized (this) {
+                while (!dm.dead) {
+                    wait();
+                }
+            }
+        } catch (InterruptedException e) {
+        }
+    }
+
+    public void closing(int rc) {
+        synchronized (this) {
+            notifyAll();
+        }
+    }
+
+    static class StreamWriter extends Thread {
+        OutputStream os;
+
+        InputStream is;
+
+        StreamWriter(InputStream is, OutputStream os) {
+            this.is = is;
+            this.os = os;
+            start();
+        }
+
+        public void run() {
+            byte b[] = new byte[80];
+            int rc;
+            try {
+                while ((rc = is.read(b)) > 0) {
+                    os.write(b, 0, rc);
+                }
+            } catch (IOException e) {
+            }
+
+        }
+    }
+
+    public void exists(byte[] data) {
+        if (data == null) {
+            if (child != null) {
+                System.out.println("Killing process");
+                child.destroy();
+                try {
+                    child.waitFor();
+                } catch (InterruptedException e) {
+                }
+            }
+            child = null;
+        } else {
+            if (child != null) {
+                System.out.println("Stopping child");
+                child.destroy();
+                try {
+                    child.waitFor();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+            try {
+                FileOutputStream fos = new FileOutputStream(filename);
+                fos.write(data);
+                fos.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            try {
+                System.out.println("Starting child");
+                child = Runtime.getRuntime().exec(exec);
+                new StreamWriter(child.getInputStream(), System.out);
+                new StreamWriter(child.getErrorStream(), System.err);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}
+</programlisting>
+	
+</example>
+
+<example id="eg_DataMonitor_java">
+	<title>DataMonitor.java</title>
+	<programlisting>
+/**
+ * A simple class that monitors the data and existence of a ZooKeeper
+ * node. It uses asynchronous ZooKeeper APIs.
+ */
+import java.util.Arrays;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.AsyncCallback.StatCallback;
+import org.apache.zookeeper.KeeperException.Code;
+import org.apache.zookeeper.data.Stat;
+
+public class DataMonitor implements Watcher, StatCallback {
+
+    ZooKeeper zk;
+
+    String znode;
+
+    Watcher chainedWatcher;
+
+    boolean dead;
+
+    DataMonitorListener listener;
+
+    byte prevData[];
+
+    public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher,
+            DataMonitorListener listener) {
+        this.zk = zk;
+        this.znode = znode;
+        this.chainedWatcher = chainedWatcher;
+        this.listener = listener;
+        // Get things started by checking if the node exists. We are going
+        // to be completely event driven
+        zk.exists(znode, true, this, null);
+    }
+
+    /**
+     * Other classes use the DataMonitor by implementing this method
+     */
+    public interface DataMonitorListener {
+        /**
+         * The existence status of the node has changed.
+         */
+        void exists(byte data[]);
+
+        /**
+         * The ZooKeeper session is no longer valid.
+         *
+         * @param rc
+         *                the ZooKeeper reason code
+         */
+        void closing(int rc);
+    }
+
+    public void process(WatchedEvent event) {
+        String path = event.getPath();
+        if (event.getType() == Event.EventType.None) {
+            // We are are being told that the state of the
+            // connection has changed
+            switch (event.getState()) {
+            case SyncConnected:
+                // In this particular example we don't need to do anything
+                // here - watches are automatically re-registered with 
+                // server and any watches triggered while the client was 
+                // disconnected will be delivered (in order of course)
+                break;
+            case Expired:
+                // It's all over
+                dead = true;
+                listener.closing(KeeperException.Code.SessionExpired);
+                break;
+            }
+        } else {
+            if (path != null &amp;&amp; path.equals(znode)) {
+                // Something has changed on the node, let's find out
+                zk.exists(znode, true, this, null);
+            }
+        }
+        if (chainedWatcher != null) {
+            chainedWatcher.process(event);
+        }
+    }
+
+    public void processResult(int rc, String path, Object ctx, Stat stat) {
+        boolean exists;
+        switch (rc) {
+        case Code.Ok:
+            exists = true;
+            break;
+        case Code.NoNode:
+            exists = false;
+            break;
+        case Code.SessionExpired:
+        case Code.NoAuth:
+            dead = true;
+            listener.closing(rc);
+            return;
+        default:
+            // Retry errors
+            zk.exists(znode, true, this, null);
+            return;
+        }
+
+        byte b[] = null;
+        if (exists) {
+            try {
+                b = zk.getData(znode, false, null);
+            } catch (KeeperException e) {
+                // We don't need to worry about recovering now. The watch
+                // callbacks will kick off any exception handling
+                e.printStackTrace();
+            } catch (InterruptedException e) {
+                return;
+            }
+        }
+        if ((b == null &amp;&amp; b != prevData)
+                || (b != null &amp;&amp; !Arrays.equals(prevData, b))) {
+            listener.exists(b);
+            prevData = b;
+        }
+    }
+}
+</programlisting>
+</example>
+</section>
+
+
+
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/recipes.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/recipes.xml b/zookeeper-docs/src/documentation/content/xdocs/recipes.xml
new file mode 100644
index 0000000..f53536f
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/recipes.xml
@@ -0,0 +1,688 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="ar_Recipes">
+  <title>ZooKeeper Recipes and Solutions</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This guide contains pseudocode and guidelines for using Zookeeper to
+      solve common problems in Distributed Application Coordination. It
+      discusses such problems as event handlers, queues, and locks..</para>
+
+      <para>$Revision: 1.6 $ $Date: 2008/09/19 03:46:18 $</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_recipes">
+    <title>A Guide to Creating Higher-level Constructs with ZooKeeper</title>
+
+    <para>In this article, you'll find guidelines for using
+    ZooKeeper to implement higher order functions. All of them are conventions
+    implemented at the client and do not require special support from
+    ZooKeeper. Hopfully the community will capture these conventions in client-side libraries 
+    to ease their use and to encourage standardization.</para>
+
+    <para>One of the most interesting things about ZooKeeper is that even
+    though ZooKeeper uses <emphasis>asynchronous</emphasis> notifications, you
+    can use it to build <emphasis>synchronous</emphasis> consistency
+    primitives, such as queues and locks. As you will see, this is possible
+    because ZooKeeper imposes an overall order on updates, and has mechanisms
+    to expose this ordering.</para>
+
+    <para>Note that the recipes below attempt to employ best practices. In
+    particular, they avoid polling, timers or anything else that would result
+    in a "herd effect", causing bursts of traffic and limiting
+    scalability.</para>
+
+    <para>There are many useful functions that can be imagined that aren't
+    included here - revocable read-write priority locks, as just one example.
+    And some of the constructs mentioned here - locks, in particular -
+    illustrate certain points, even though you may find other constructs, such
+    as event handles or queues, a more practical means of performing the same
+    function. In general, the examples in this section are designed to
+    stimulate thought.</para>
+
+  <section id="sc_recipes_errorHandlingNote">
+    <title>Important Note About Error Handling</title>
+
+	<para>When implementing the recipes you must handle recoverable exceptions 
+        (see the <ulink url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ">FAQ</ulink>). In 
+	particular, several of the recipes employ sequential ephemeral 
+	nodes. When creating a sequential ephemeral node there is an error case in 
+	which the create() succeeds on the server but the server crashes before 
+	returning the name of the node to the client. When the client reconnects its 
+	session is still valid and, thus, the node is not removed. The implication is 
+	that it is difficult for the client to know if its node was created or not. The 
+	recipes below include measures to handle this.</para>
+  </section>
+
+  <section id="sc_outOfTheBox">
+    <title>Out of the Box Applications: Name Service, Configuration, Group
+    Membership</title>
+
+    <para>Name service and configuration are two of the primary applications
+    of ZooKeeper. These two functions are provided directly by the ZooKeeper
+    API.</para>
+
+    <para>Another function directly provided by ZooKeeper is <emphasis>group
+    membership</emphasis>. The group is represented by a node. Members of the
+    group create ephemeral nodes under the group node. Nodes of the members
+    that fail abnormally will be removed automatically when ZooKeeper detects
+    the failure.</para>
+  </section>
+
+  <section id="sc_recipes_eventHandles">
+    <title>Barriers</title>
+
+    <para>Distributed systems use <emphasis>barriers</emphasis>
+      to block processing of a set of nodes until a condition is met
+      at which time all the nodes are allowed to proceed. Barriers are
+      implemented in ZooKeeper by designating a barrier node. The
+      barrier is in place if the barrier node exists. Here's the
+      pseudo code:</para>
+
+    <orderedlist>
+      <listitem>
+        <para>Client calls the ZooKeeper API's <emphasis
+        role="bold">exists()</emphasis> function on the barrier node, with
+        <emphasis>watch</emphasis> set to true.</para>
+      </listitem>
+
+      <listitem>
+        <para>If <emphasis role="bold">exists()</emphasis> returns false, the
+        barrier is gone and the client proceeds</para>
+      </listitem>
+
+      <listitem>
+        <para>Else, if <emphasis role="bold">exists()</emphasis> returns true,
+        the clients wait for a watch event from ZooKeeper for the barrier
+        node.</para>
+      </listitem>
+
+      <listitem>
+        <para>When the watch event is triggered, the client reissues the
+        <emphasis role="bold">exists( )</emphasis> call, again waiting until
+        the barrier node is removed.</para>
+      </listitem>
+    </orderedlist>
+
+    <section id="sc_doubleBarriers">
+      <title>Double Barriers</title>
+
+      <para>Double barriers enable clients to synchronize the beginning and
+      the end of a computation. When enough processes have joined the barrier,
+      processes start their computation and leave the barrier once they have
+      finished. This recipe shows how to use a ZooKeeper node as a
+      barrier.</para>
+
+      <para>The pseudo code in this recipe represents the barrier node as
+      <emphasis>b</emphasis>. Every client process <emphasis>p</emphasis>
+      registers with the barrier node on entry and unregisters when it is
+      ready to leave. A node registers with the barrier node via the <emphasis
+      role="bold">Enter</emphasis> procedure below, it waits until
+      <emphasis>x</emphasis> client process register before proceeding with
+      the computation. (The <emphasis>x</emphasis> here is up to you to
+      determine for your system.)</para>
+
+      <informaltable colsep="0" frame="none" rowsep="0">
+        <tgroup cols="2">
+          <tbody>
+            <row>
+              <entry align="center"><emphasis
+                                       role="bold">Enter</emphasis></entry>
+
+              <entry align="center"><emphasis
+                                       role="bold">Leave</emphasis></entry>
+            </row>
+
+            <row>
+              <entry align="left"><orderedlist>
+                  <listitem>
+                    <para>Create a name <emphasis><emphasis>n</emphasis> =
+                        <emphasis>b</emphasis>+“/”+<emphasis>p</emphasis></emphasis></para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Set watch: <emphasis
+                                        role="bold">exists(<emphasis>b</emphasis> + ‘‘/ready’’,
+                        true)</emphasis></para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Create child: <emphasis role="bold">create(
+                        <emphasis>n</emphasis>, EPHEMERAL)</emphasis></para>
+                  </listitem>
+
+                  <listitem>
+                    <para><emphasis role="bold">L = getChildren(b,
+                        false)</emphasis></para>
+                  </listitem>
+
+                  <listitem>
+                    <para>if fewer children in L than<emphasis>
+                        x</emphasis>, wait for watch event</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>else <emphasis role="bold">create(b + ‘‘/ready’’,
+                        REGULAR)</emphasis></para>
+                  </listitem>
+                </orderedlist></entry>
+
+              <entry><orderedlist>
+                  <listitem>
+                    <para><emphasis role="bold">L = getChildren(b,
+                        false)</emphasis></para>
+                  </listitem>
+
+                  <listitem>
+                    <para>if no children, exit</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>if <emphasis>p</emphasis> is only process node in
+                      L, delete(n) and exit</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>if <emphasis>p</emphasis> is the lowest process
+                      node in L, wait on highest process node in L</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>else <emphasis
+                                  role="bold">delete(<emphasis>n</emphasis>) </emphasis>if
+                      still exists and wait on lowest process node in L</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>goto 1</para>
+                  </listitem>
+                </orderedlist></entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+      <para>On entering, all processes watch on a ready node and
+        create an ephemeral node as a child of the barrier node. Each process
+        but the last enters the barrier and waits for the ready node to appear
+        at line 5. The process that creates the xth node, the last process, will
+        see x nodes in the list of children and create the ready node, waking up
+        the other processes. Note that waiting processes wake up only when it is
+        time to exit, so waiting is efficient.
+      </para>
+
+      <para>On exit, you can't use a flag such as <emphasis>ready</emphasis>
+      because you are watching for process nodes to go away. By using
+      ephemeral nodes, processes that fail after the barrier has been entered
+      do not prevent correct processes from finishing. When processes are
+      ready to leave, they need to delete their process nodes and wait for all
+      other processes to do the same.</para>
+
+      <para>Processes exit when there are no process nodes left as children of
+      <emphasis>b</emphasis>. However, as an efficiency, you can use the
+      lowest process node as the ready flag. All other processes that are
+      ready to exit watch for the lowest existing process node to go away, and
+      the owner of the lowest process watches for any other process node
+      (picking the highest for simplicity) to go away. This means that only a
+      single process wakes up on each node deletion except for the last node,
+      which wakes up everyone when it is removed.</para>
+    </section>
+  </section>
+
+  <section id="sc_recipes_Queues">
+    <title>Queues</title>
+
+    <para>Distributed queues are a common data structure. To implement a
+    distributed queue in ZooKeeper, first designate a znode to hold the queue,
+    the queue node. The distributed clients put something into the queue by
+    calling create() with a pathname ending in "queue-", with the
+    <emphasis>sequence</emphasis> and <emphasis>ephemeral</emphasis> flags in
+    the create() call set to true. Because the <emphasis>sequence</emphasis>
+    flag is set, the new pathnames will have the form
+    _path-to-queue-node_/queue-X, where X is a monotonic increasing number. A
+    client that wants to be removed from the queue calls ZooKeeper's <emphasis
+    role="bold">getChildren( )</emphasis> function, with
+    <emphasis>watch</emphasis> set to true on the queue node, and begins
+    processing nodes with the lowest number. The client does not need to issue
+    another <emphasis role="bold">getChildren( )</emphasis> until it exhausts
+    the list obtained from the first <emphasis role="bold">getChildren(
+    )</emphasis> call. If there are are no children in the queue node, the
+    reader waits for a watch notification to check the queue again.</para>
+
+    <note>
+      <para>There now exists a Queue implementation in ZooKeeper
+      recipes directory. This is distributed with the release --
+      src/recipes/queue directory of the release artifact.
+      </para>
+    </note>
+
+    <section id="sc_recipes_priorityQueues">
+      <title>Priority Queues</title>
+
+      <para>To implement a priority queue, you need only make two simple
+      changes to the generic <ulink url="#sc_recipes_Queues">queue
+      recipe</ulink> . First, to add to a queue, the pathname ends with
+      "queue-YY" where YY is the priority of the element with lower numbers
+      representing higher priority (just like UNIX). Second, when removing
+      from the queue, a client uses an up-to-date children list meaning that
+      the client will invalidate previously obtained children lists if a watch
+      notification triggers for the queue node.</para>
+    </section>
+  </section>
+
+  <section id="sc_recipes_Locks">
+    <title>Locks</title>
+
+    <para>Fully distributed locks that are globally synchronous, meaning at
+    any snapshot in time no two clients think they hold the same lock. These
+    can be implemented using ZooKeeeper. As with priority queues, first define
+    a lock node.</para>
+
+    <note>
+      <para>There now exists a Lock implementation in ZooKeeper
+      recipes directory. This is distributed with the release --
+      src/recipes/lock directory of the release artifact.
+      </para>
+    </note>
+
+    <para>Clients wishing to obtain a lock do the following:</para>
+
+    <orderedlist>
+      <listitem>
+        <para>Call <emphasis role="bold">create( )</emphasis> with a pathname
+        of "_locknode_/guid-lock-" and the <emphasis>sequence</emphasis> and
+        <emphasis>ephemeral</emphasis> flags set. The <emphasis>guid</emphasis> 
+		is needed in case the create() result is missed. See the note below.</para>
+      </listitem>
+
+      <listitem>
+        <para>Call <emphasis role="bold">getChildren( )</emphasis> on the lock
+        node <emphasis>without</emphasis> setting the watch flag (this is
+        important to avoid the herd effect).</para>
+      </listitem>
+
+      <listitem>
+        <para>If the pathname created in step <emphasis
+        role="bold">1</emphasis> has the lowest sequence number suffix, the
+        client has the lock and the client exits the protocol.</para>
+      </listitem>
+
+      <listitem>
+        <para>The client calls <emphasis role="bold">exists( )</emphasis> with
+        the watch flag set on the path in the lock directory with the next
+        lowest sequence number.</para>
+      </listitem>
+
+      <listitem>
+        <para>if <emphasis role="bold">exists( )</emphasis> returns false, go
+        to step <emphasis role="bold">2</emphasis>. Otherwise, wait for a
+        notification for the pathname from the previous step before going to
+        step <emphasis role="bold">2</emphasis>.</para>
+      </listitem>
+    </orderedlist>
+
+    <para>The unlock protocol is very simple: clients wishing to release a
+    lock simply delete the node they created in step 1.</para>
+
+    <para>Here are a few things to notice:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>The removal of a node will only cause one client to wake up
+        since each node is watched by exactly one client. In this way, you
+        avoid the herd effect.</para>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>There is no polling or timeouts.</para>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>Because of the way you implement locking, it is easy to see the
+        amount of lock contention, break locks, debug locking problems,
+        etc.</para>
+      </listitem>
+    </itemizedlist>
+
+	<section id="sc_recipes_GuidNote">
+      <title>Recoverable Errors and the GUID</title>
+    <itemizedlist>
+      <listitem>
+        <para>If a recoverable error occurs calling <emphasis role="bold">create()</emphasis> the 
+		client should call <emphasis role="bold">getChildren()</emphasis> and check for a node 
+		containing the <emphasis>guid</emphasis> used in the path name. 
+		This handles the case (noted <ulink url="#sc_recipes_errorHandlingNote">above</ulink>) of 
+		the create() succeeding on the server but the server crashing before returning the name 
+		of the new node.</para>
+      </listitem>
+    </itemizedlist>
+	</section>
+
+    <section>
+      <title>Shared Locks</title>
+
+      <para>You can implement shared locks by with a few changes to the lock
+      protocol:</para>
+
+      <informaltable colsep="0" frame="none" rowsep="0">
+        <tgroup cols="2">
+          <tbody>
+            <row>
+              <entry align="center"><emphasis role="bold">Obtaining a read
+              lock:</emphasis></entry>
+
+              <entry align="center"><emphasis role="bold">Obtaining a write
+              lock:</emphasis></entry>
+            </row>
+
+            <row>
+              <entry align="left"><orderedlist>
+                  <listitem>
+                    <para>Call <emphasis role="bold">create( )</emphasis> to
+                    create a node with pathname
+                    "<filename>guid-/read-</filename>". This is the
+                    lock node use later in the protocol. Make sure to set both
+                    the <emphasis>sequence</emphasis> and
+                    <emphasis>ephemeral</emphasis> flags.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Call <emphasis role="bold">getChildren( )</emphasis>
+                    on the lock node <emphasis>without</emphasis> setting the
+                    <emphasis>watch</emphasis> flag - this is important, as it
+                    avoids the herd effect.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>If there are no children with a pathname starting
+                    with "<filename>write-</filename>" and having a lower
+                    sequence number than the node created in step <emphasis
+                    role="bold">1</emphasis>, the client has the lock and can
+                    exit the protocol. </para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Otherwise, call <emphasis role="bold">exists(
+                    )</emphasis>, with <emphasis>watch</emphasis> flag, set on
+                    the node in lock directory with pathname staring with
+                    "<filename>write-</filename>" having the next lowest
+                    sequence number.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>If <emphasis role="bold">exists( )</emphasis>
+                    returns <emphasis>false</emphasis>, goto step <emphasis
+                    role="bold">2</emphasis>.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Otherwise, wait for a notification for the pathname
+                    from the previous step before going to step <emphasis
+                    role="bold">2</emphasis></para>
+                  </listitem>
+                </orderedlist></entry>
+
+              <entry><orderedlist>
+                  <listitem>
+                    <para>Call <emphasis role="bold">create( )</emphasis> to
+                    create a node with pathname
+                    "<filename>guid-/write-</filename>". This is the
+                    lock node spoken of later in the protocol. Make sure to
+                    set both <emphasis>sequence</emphasis> and
+                    <emphasis>ephemeral</emphasis> flags.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Call <emphasis role="bold">getChildren( )
+                    </emphasis> on the lock node <emphasis>without</emphasis>
+                    setting the <emphasis>watch</emphasis> flag - this is
+                    important, as it avoids the herd effect.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>If there are no children with a lower sequence
+                    number than the node created in step <emphasis
+                    role="bold">1</emphasis>, the client has the lock and the
+                    client exits the protocol.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>Call <emphasis role="bold">exists( ),</emphasis>
+                    with <emphasis>watch</emphasis> flag set, on the node with
+                    the pathname that has the next lowest sequence
+                    number.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>If <emphasis role="bold">exists( )</emphasis>
+                    returns <emphasis>false</emphasis>, goto step <emphasis
+                    role="bold">2</emphasis>. Otherwise, wait for a
+                    notification for the pathname from the previous step
+                    before going to step <emphasis
+                    role="bold">2</emphasis>.</para>
+                  </listitem>
+                </orderedlist></entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+
+    <para>Notes:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>It might appear that this recipe creates a herd effect:
+          when there is a large group of clients waiting for a read
+          lock, and all getting notified more or less simultaneously
+          when the "<filename>write-</filename>" node with the lowest
+          sequence number is deleted. In fact. that's valid behavior:
+          as all those waiting reader clients should be released since
+          they have the lock. The herd effect refers to releasing a
+          "herd" when in fact only a single or a small number of
+          machines can proceed.</para>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>See the <ulink url="#sc_recipes_GuidNote">note for Locks</ulink> on how to use the guid in the node.</para>
+      </listitem>
+    </itemizedlist>
+
+	</section>
+
+    <section id="sc_revocableSharedLocks">
+      <title>Revocable Shared Locks</title>
+
+      <para>With minor modifications to the Shared Lock protocol, you make
+      shared locks revocable by modifying the shared lock protocol:</para>
+
+      <para>In step <emphasis role="bold">1</emphasis>, of both obtain reader
+      and writer lock protocols, call <emphasis role="bold">getData(
+      )</emphasis> with <emphasis>watch</emphasis> set, immediately after the
+      call to <emphasis role="bold">create( )</emphasis>. If the client
+      subsequently receives notification for the node it created in step
+      <emphasis role="bold">1</emphasis>, it does another <emphasis
+      role="bold">getData( )</emphasis> on that node, with
+      <emphasis>watch</emphasis> set and looks for the string "unlock", which
+      signals to the client that it must release the lock. This is because,
+      according to this shared lock protocol, you can request the client with
+      the lock give up the lock by calling <emphasis role="bold">setData()
+      </emphasis> on the lock node, writing "unlock" to that node.</para>
+
+      <para>Note that this protocol requires the lock holder to consent to
+      releasing the lock. Such consent is important, especially if the lock
+      holder needs to do some processing before releasing the lock. Of course
+      you can always implement <emphasis>Revocable Shared Locks with Freaking
+      Laser Beams</emphasis> by stipulating in your protocol that the revoker
+      is allowed to delete the lock node if after some length of time the lock
+      isn't deleted by the lock holder.</para>
+    </section>
+  </section>
+
+  <section id="sc_recipes_twoPhasedCommit">
+    <title>Two-phased Commit</title>
+
+    <para>A two-phase commit protocol is an algorithm that lets all clients in
+    a distributed system agree either to commit a transaction or abort.</para>
+
+    <para>In ZooKeeper, you can implement a two-phased commit by having a
+    coordinator create a transaction node, say "/app/Tx", and one child node
+    per participating site, say "/app/Tx/s_i". When coordinator creates the
+    child node, it leaves the content undefined. Once each site involved in
+    the transaction receives the transaction from the coordinator, the site
+    reads each child node and sets a watch. Each site then processes the query
+    and votes "commit" or "abort" by writing to its respective node. Once the
+    write completes, the other sites are notified, and as soon as all sites
+    have all votes, they can decide either "abort" or "commit". Note that a
+    node can decide "abort" earlier if some site votes for "abort".</para>
+
+    <para>An interesting aspect of this implementation is that the only role
+    of the coordinator is to decide upon the group of sites, to create the
+    ZooKeeper nodes, and to propagate the transaction to the corresponding
+    sites. In fact, even propagating the transaction can be done through
+    ZooKeeper by writing it in the transaction node.</para>
+
+    <para>There are two important drawbacks of the approach described above.
+    One is the message complexity, which is O(n²). The second is the
+    impossibility of detecting failures of sites through ephemeral nodes. To
+    detect the failure of a site using ephemeral nodes, it is necessary that
+    the site create the node.</para>
+
+    <para>To solve the first problem, you can have only the coordinator
+    notified of changes to the transaction nodes, and then notify the sites
+    once coordinator reaches a decision. Note that this approach is scalable,
+    but it's is slower too, as it requires all communication to go through the
+    coordinator.</para>
+
+    <para>To address the second problem, you can have the coordinator
+    propagate the transaction to the sites, and have each site creating its
+    own ephemeral node.</para>
+  </section>
+
+  <section id="sc_leaderElection">
+    <title>Leader Election</title>
+
+    <para>A simple way of doing leader election with ZooKeeper is to use the
+    <emphasis role="bold">SEQUENCE|EPHEMERAL</emphasis> flags when creating
+    znodes that represent "proposals" of clients. The idea is to have a znode,
+    say "/election", such that each znode creates a child znode "/election/guid-n_"
+    with both flags SEQUENCE|EPHEMERAL. With the sequence flag, ZooKeeper
+    automatically appends a sequence number that is greater than any one
+    previously appended to a child of "/election". The process that created
+    the znode with the smallest appended sequence number is the leader.
+    </para>
+
+    <para>That's not all, though. It is important to watch for failures of the
+    leader, so that a new client arises as the new leader in the case the
+    current leader fails. A trivial solution is to have all application
+    processes watching upon the current smallest znode, and checking if they
+    are the new leader when the smallest znode goes away (note that the
+    smallest znode will go away if the leader fails because the node is
+    ephemeral). But this causes a herd effect: upon a failure of the current
+    leader, all other processes receive a notification, and execute
+    getChildren on "/election" to obtain the current list of children of
+    "/election". If the number of clients is large, it causes a spike on the
+    number of operations that ZooKeeper servers have to process. To avoid the
+    herd effect, it is sufficient to watch for the next znode down on the
+    sequence of znodes. If a client receives a notification that the znode it
+    is watching is gone, then it becomes the new leader in the case that there
+    is no smaller znode. Note that this avoids the herd effect by not having
+    all clients watching the same znode. </para>
+
+    <para>Here's the pseudo code:</para>
+
+    <para>Let ELECTION be a path of choice of the application. To volunteer to
+    be a leader: </para>
+
+    <orderedlist>
+      <listitem>
+        <para>Create znode z with path "ELECTION/guid-n_" with both SEQUENCE and
+        EPHEMERAL flags;</para>
+      </listitem>
+
+      <listitem>
+        <para>Let C be the children of "ELECTION", and i be the sequence
+        number of z;</para>
+      </listitem>
+
+      <listitem>
+        <para>Watch for changes on "ELECTION/guid-n_j", where j is the largest
+        sequence number such that j &lt; i and n_j is a znode in C;</para>
+      </listitem>
+    </orderedlist>
+
+    <para>Upon receiving a notification of znode deletion: </para>
+
+    <orderedlist>
+      <listitem>
+        <para>Let C be the new set of children of ELECTION; </para>
+      </listitem>
+
+      <listitem>
+        <para>If z is the smallest node in C, then execute leader
+        procedure;</para>
+      </listitem>
+
+      <listitem>
+        <para>Otherwise, watch for changes on "ELECTION/guid-n_j", where j is the
+        largest sequence number such that j &lt; i and n_j is a znode in C;
+        </para>
+      </listitem>
+    </orderedlist>
+
+	<para>Notes:</para>
+
+    <itemizedlist>
+      <listitem>
+	    <para>Note that the znode having no preceding znode on the list of
+	    children does not imply that the creator of this znode is aware that it is
+	    the current leader. Applications may consider creating a separate znode
+	    to acknowledge that the leader has executed the leader procedure. </para>
+      </listitem>
+    </itemizedlist>
+
+    <itemizedlist>
+      <listitem>
+        <para>See the <ulink url="#sc_recipes_GuidNote">note for Locks</ulink> on how to use the guid in the node.</para>
+      </listitem>
+    </itemizedlist>
+
+  </section>
+  </section>
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/site.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/site.xml b/zookeeper-docs/src/documentation/content/xdocs/site.xml
new file mode 100644
index 0000000..614fa6c
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/site.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!--
+Forrest site.xml
+
+This file contains an outline of the site's information content.  It is used to:
+- Generate the website menus (though these can be overridden - see docs)
+- Provide semantic, location-independent aliases for internal 'site:' URIs, eg
+<link href="site:changes"> links to changes.html (or ../changes.html if in
+  subdir).
+- Provide aliases for external URLs in the external-refs section.  Eg, <link
+  href="ext:cocoon"> links to http://xml.apache.org/cocoon/
+
+See http://forrest.apache.org/docs/linking.html for more info.
+-->
+
+<site label="ZooKeeper" href="" xmlns="http://apache.org/forrest/linkmap/1.0">
+
+  <docs label="Overview"> 
+    <welcome   label="Welcome"                href="index.html" />
+    <overview  label="Overview"               href="zookeeperOver.html" />
+    <started   label="Getting Started"        href="zookeeperStarted.html" />
+    <relnotes  label="Release Notes"          href="ext:relnotes" />
+  </docs>
+  
+  <docs label="Developer">
+    <api       label="API Docs"               href="ext:api/index" />
+    <program   label="Programmer's Guide"     href="zookeeperProgrammers.html" />
+    <javaEx    label="Java Example"     href="javaExample.html" />
+    <barTutor  label="Barrier and Queue Tutorial" href="zookeeperTutorial.html" />
+    <recipes   label="Recipes"		      href="recipes.html" />
+  </docs>
+  
+  <docs label="Admin &amp; Ops">
+      <admin label="Administrator's Guide"  href="zookeeperAdmin.html" />
+      <quota label="Quota Guide"            href="zookeeperQuotas.html" />
+      <jmx   label="JMX"                    href="zookeeperJMX.html" />
+      <observers label="Observers Guide" href="zookeeperObservers.html" />
+      <reconfig label="Dynamic Reconfiguration" href="zookeeperReconfig.html" />
+  </docs>
+  
+  <docs label="Contributor">
+      <internals label="ZooKeeper Internals"	href="zookeeperInternals.html" />
+  </docs>
+  
+  <docs label="Miscellaneous">
+    <wiki      label="Wiki"                   href="ext:wiki" />
+    <faq       label="FAQ"                    href="ext:faq" />
+    <lists     label="Mailing Lists"          href="ext:lists" />
+    <!--<other     label="Other Info"	      href="zookeeperOtherInfo.html" />-->
+  </docs>
+  
+  
+
+  <external-refs>
+    <site      href="http://zookeeper.apache.org/"/>
+    <lists     href="http://zookeeper.apache.org/mailing_lists.html"/>
+    <releases  href="http://zookeeper.apache.org/releases.html">
+      <download href="#Download" />
+    </releases>
+    <jira      href="http://zookeeper.apache.org/issue_tracking.html"/>
+    <wiki      href="https://cwiki.apache.org/confluence/display/ZOOKEEPER" />
+    <faq       href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ" />
+    <zlib      href="http://www.zlib.net/" />
+    <lzo       href="http://www.oberhumer.com/opensource/lzo/" />
+    <gzip      href="http://www.gzip.org/" />
+    <cygwin    href="http://www.cygwin.com/" />
+    <osx       href="http://www.apple.com/macosx" />
+    <relnotes  href="releasenotes.html" />
+    <api href="api/">
+      <started href="overview-summary.html#overview_description" />
+      <index href="index.html" />
+      <org href="org/">
+        <apache href="apache/">
+          <zookeeper href="zookeeper/">
+          </zookeeper>
+        </apache>
+      </org>
+    </api>
+  </external-refs>
+ 
+</site>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/tabs.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/tabs.xml b/zookeeper-docs/src/documentation/content/xdocs/tabs.xml
new file mode 100644
index 0000000..af6c447
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/tabs.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.0//EN" 
+          "http://forrest.apache.org/dtd/tab-cocoon-v10.dtd">
+
+<tabs software="ZooKeeper"
+      title="ZooKeeper"
+      copyright="The Apache Software Foundation"
+      xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <!-- The rules are:
+    @dir will always have /index.html added.
+    @href is not modified unless it is root-relative and obviously specifies a
+    directory (ends in '/'), in which case /index.html will be added
+  -->
+
+  <tab label="Project" href="http://zookeeper.apache.org/" />
+  <tab label="Wiki" href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/" />
+  <tab label="ZooKeeper 3.6 Documentation" dir="" />
+  
+</tabs>


[13/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

First iteration of the directory changes in maven migration.
This time, the empty zookeeper-it for future integration tests were created, and the docs source were moved to zookeeper-docs.
Tested with forest v0.9, documents generations were successful with ant.

Author: Norbert Kalmar <nk...@yahoo.com>

Reviewers: Andor Molnar <an...@apache.org>

Closes #550 from nkalmar/ZOOKEEPER-3022-1


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/4607a3e1
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/4607a3e1
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/4607a3e1

Branch: refs/heads/master
Commit: 4607a3e156f36c52349bfb370e879dbd9e4d0691
Parents: 3465e0c
Author: Norbert Kalmar <nk...@yahoo.com>
Authored: Wed Jul 4 13:02:19 2018 +0200
Committer: Andor Molnar <an...@apache.org>
Committed: Wed Jul 4 13:02:19 2018 +0200

----------------------------------------------------------------------
 build.xml                                       |    2 +-
 src/docs/forrest.properties                     |  109 -
 src/docs/src/documentation/README.txt           |    7 -
 src/docs/src/documentation/TODO.txt             |  227 --
 .../classes/CatalogManager.properties           |   37 -
 src/docs/src/documentation/conf/cli.xconf       |  328 ---
 .../src/documentation/content/xdocs/index.xml   |   87 -
 .../documentation/content/xdocs/javaExample.xml |  664 -----
 .../src/documentation/content/xdocs/recipes.xml |  688 -----
 .../src/documentation/content/xdocs/site.xml    |   97 -
 .../src/documentation/content/xdocs/tabs.xml    |   36 -
 .../content/xdocs/zookeeperAdmin.xml            | 2353 ------------------
 .../xdocs/zookeeperHierarchicalQuorums.xml      |   75 -
 .../content/xdocs/zookeeperInternals.xml        |  487 ----
 .../content/xdocs/zookeeperJMX.xml              |  236 --
 .../content/xdocs/zookeeperObservers.xml        |  145 --
 .../content/xdocs/zookeeperOtherInfo.xml        |   46 -
 .../content/xdocs/zookeeperOver.xml             |  464 ----
 .../content/xdocs/zookeeperProgrammers.xml      | 2008 ---------------
 .../content/xdocs/zookeeperQuotas.xml           |   71 -
 .../content/xdocs/zookeeperReconfig.xml         |  878 -------
 .../content/xdocs/zookeeperStarted.xml          |  419 ----
 .../content/xdocs/zookeeperTutorial.xml         |  712 ------
 .../src/documentation/resources/images/2pc.jpg  |  Bin 15174 -> 0 bytes
 .../resources/images/bk-overview.jpg            |  Bin 124211 -> 0 bytes
 .../documentation/resources/images/favicon.ico  |  Bin 766 -> 0 bytes
 .../resources/images/hadoop-logo.jpg            |  Bin 9443 -> 0 bytes
 .../resources/images/state_dia.dia              |  Bin 2597 -> 0 bytes
 .../resources/images/state_dia.jpg              |  Bin 51364 -> 0 bytes
 .../documentation/resources/images/zkarch.jpg   |  Bin 24535 -> 0 bytes
 .../resources/images/zkcomponents.jpg           |  Bin 30831 -> 0 bytes
 .../resources/images/zknamespace.jpg            |  Bin 35414 -> 0 bytes
 .../resources/images/zkperfRW-3.2.jpg           |  Bin 41948 -> 0 bytes
 .../documentation/resources/images/zkperfRW.jpg |  Bin 161542 -> 0 bytes
 .../resources/images/zkperfreliability.jpg      |  Bin 69825 -> 0 bytes
 .../resources/images/zkservice.jpg              |  Bin 86790 -> 0 bytes
 .../resources/images/zookeeper_small.gif        |  Bin 4847 -> 0 bytes
 src/docs/src/documentation/skinconf.xml         |  360 ---
 src/docs/status.xml                             |   74 -
 zookeeper-docs/forrest.properties               |  109 +
 zookeeper-docs/src/documentation/README.txt     |    7 +
 zookeeper-docs/src/documentation/TODO.txt       |  227 ++
 .../classes/CatalogManager.properties           |   37 +
 zookeeper-docs/src/documentation/conf/cli.xconf |  328 +++
 .../src/documentation/content/xdocs/index.xml   |   87 +
 .../documentation/content/xdocs/javaExample.xml |  664 +++++
 .../src/documentation/content/xdocs/recipes.xml |  688 +++++
 .../src/documentation/content/xdocs/site.xml    |   97 +
 .../src/documentation/content/xdocs/tabs.xml    |   36 +
 .../content/xdocs/zookeeperAdmin.xml            | 2353 ++++++++++++++++++
 .../xdocs/zookeeperHierarchicalQuorums.xml      |   75 +
 .../content/xdocs/zookeeperInternals.xml        |  487 ++++
 .../content/xdocs/zookeeperJMX.xml              |  236 ++
 .../content/xdocs/zookeeperObservers.xml        |  145 ++
 .../content/xdocs/zookeeperOtherInfo.xml        |   46 +
 .../content/xdocs/zookeeperOver.xml             |  464 ++++
 .../content/xdocs/zookeeperProgrammers.xml      | 2008 +++++++++++++++
 .../content/xdocs/zookeeperQuotas.xml           |   71 +
 .../content/xdocs/zookeeperReconfig.xml         |  878 +++++++
 .../content/xdocs/zookeeperStarted.xml          |  419 ++++
 .../content/xdocs/zookeeperTutorial.xml         |  712 ++++++
 .../src/documentation/resources/images/2pc.jpg  |  Bin 0 -> 15174 bytes
 .../resources/images/bk-overview.jpg            |  Bin 0 -> 124211 bytes
 .../documentation/resources/images/favicon.ico  |  Bin 0 -> 766 bytes
 .../resources/images/hadoop-logo.jpg            |  Bin 0 -> 9443 bytes
 .../resources/images/state_dia.dia              |  Bin 0 -> 2597 bytes
 .../resources/images/state_dia.jpg              |  Bin 0 -> 51364 bytes
 .../documentation/resources/images/zkarch.jpg   |  Bin 0 -> 24535 bytes
 .../resources/images/zkcomponents.jpg           |  Bin 0 -> 30831 bytes
 .../resources/images/zknamespace.jpg            |  Bin 0 -> 35414 bytes
 .../resources/images/zkperfRW-3.2.jpg           |  Bin 0 -> 41948 bytes
 .../documentation/resources/images/zkperfRW.jpg |  Bin 0 -> 161542 bytes
 .../resources/images/zkperfreliability.jpg      |  Bin 0 -> 69825 bytes
 .../resources/images/zkservice.jpg              |  Bin 0 -> 86790 bytes
 .../resources/images/zookeeper_small.gif        |  Bin 0 -> 4847 bytes
 zookeeper-docs/src/documentation/skinconf.xml   |  360 +++
 zookeeper-docs/status.xml                       |   74 +
 zookeeper-it/.empty                             |    0
 78 files changed, 10609 insertions(+), 10609 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 0e13910..eac3e2b 100644
--- a/build.xml
+++ b/build.xml
@@ -140,7 +140,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
     <property name="test.quick" value="no" />
     <property name="conf.dir" value="${basedir}/conf"/>
     <property name="docs.dir" value="${basedir}/docs"/>
-    <property name="docs.src" value="${basedir}/src/docs"/>
+    <property name="docs.src" value="${basedir}/zookeeper-docs"/>
     <property name="javadoc.link.java"
               value="http://docs.oracle.com/javase/6/docs/api/" />
     <property name="javadoc.packages" value="org.apache.*" />

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/forrest.properties
----------------------------------------------------------------------
diff --git a/src/docs/forrest.properties b/src/docs/forrest.properties
deleted file mode 100644
index 70cf81d..0000000
--- a/src/docs/forrest.properties
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright 2002-2004 The Apache Software Foundation
-#
-# Licensed 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.
-
-##############
-# Properties used by forrest.build.xml for building the website
-# These are the defaults, un-comment them if you need to change them.
-##############
-
-# Prints out a summary of Forrest settings for this project
-#forrest.echo=true 
-
-# Project name (used to name .war file)
-#project.name=my-project
-
-# Specifies name of Forrest skin to use
-#project.skin=tigris
-#project.skin=pelt
-
-# comma separated list, file:// is supported
-#forrest.skins.descriptors=http://forrest.apache.org/skins/skins.xml,file:///c:/myskins/skins.xml
-
-##############
-# behavioural properties
-#project.menu-scheme=tab_attributes
-#project.menu-scheme=directories
-
-##############
-# layout properties
-
-# Properties that can be set to override the default locations
-#
-# Parent properties must be set. This usually means uncommenting
-# project.content-dir if any other property using it is uncommented
-
-#project.status=status.xml
-#project.content-dir=src/documentation
-project.configfile=${project.home}/src/documentation/conf/cli.xconf
-#project.raw-content-dir=${project.content-dir}/content
-#project.conf-dir=${project.content-dir}/conf
-#project.sitemap-dir=${project.content-dir}
-#project.xdocs-dir=${project.content-dir}/content/xdocs
-#project.resources-dir=${project.content-dir}/resources
-#project.stylesheets-dir=${project.resources-dir}/stylesheets
-#project.images-dir=${project.resources-dir}/images
-#project.schema-dir=${project.resources-dir}/schema
-#project.skins-dir=${project.content-dir}/skins
-#project.skinconf=${project.content-dir}/skinconf.xml
-#project.lib-dir=${project.content-dir}/lib
-#project.classes-dir=${project.content-dir}/classes
-#project.translations-dir=${project.content-dir}/translations
-
-##############
-# validation properties
-
-# This set of properties determine if validation is performed
-# Values are inherited unless overridden.
-# e.g. if forrest.validate=false then all others are false unless set to true.
-forrest.validate=true
-forrest.validate.xdocs=${forrest.validate}
-forrest.validate.skinconf=${forrest.validate}
-forrest.validate.stylesheets=${forrest.validate}
-forrest.validate.skins=${forrest.validate}
-forrest.validate.skins.stylesheets=${forrest.validate.skins}
-
-# Make Forrest work with JDK6
-forrest.validate.sitemap=false
-
-# *.failonerror=(true|false) - stop when an XML file is invalid
-forrest.validate.failonerror=true
-
-# *.excludes=(pattern) - comma-separated list of path patterns to not validate
-# e.g.
-#forrest.validate.xdocs.excludes=samples/subdir/**, samples/faq.xml
-#forrest.validate.xdocs.excludes=
-
-
-##############
-# General Forrest properties
-
-# The URL to start crawling from
-#project.start-uri=linkmap.html
-# Set logging level for messages printed to the console
-# (DEBUG, INFO, WARN, ERROR, FATAL_ERROR)
-#project.debuglevel=ERROR
-# Max memory to allocate to Java
-#forrest.maxmemory=64m
-# Any other arguments to pass to the JVM. For example, to run on an X-less
-# server, set to -Djava.awt.headless=true
-#forrest.jvmargs=
-# The bugtracking URL - the issue number will be appended
-#project.bugtracking-url=http://issues.apache.org/bugzilla/show_bug.cgi?id=
-#project.bugtracking-url=http://issues.apache.org/jira/browse/
-# The issues list as rss
-#project.issues-rss-url=
-#I18n Property only works for the "forrest run" target.
-#project.i18n=true
-
-project.required.plugins=org.apache.forrest.plugin.output.pdf,org.apache.forrest.plugin.input.simplifiedDocbook

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/README.txt
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/README.txt b/src/docs/src/documentation/README.txt
deleted file mode 100644
index 9bc261b..0000000
--- a/src/docs/src/documentation/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-This is the base documentation directory.
-
-skinconf.xml     # This file customizes Forrest for your project. In it, you
-                 # tell forrest the project name, logo, copyright info, etc
-
-sitemap.xmap     # Optional. This sitemap is consulted before all core sitemaps.
-                 # See http://forrest.apache.org/docs/project-sitemap.html

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/TODO.txt
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/TODO.txt b/src/docs/src/documentation/TODO.txt
deleted file mode 100644
index 84e7dfa..0000000
--- a/src/docs/src/documentation/TODO.txt
+++ /dev/null
@@ -1,227 +0,0 @@
-This is a running list of todo documentation items. Feel free
-to add to the list or take on an item as you wish (in the form
-of a JIRA patch of course).
--------------------------------------------------------------
-
-recipes.xml:110:    
-[maybe an illustration would be nice for each recipe?]
-
-recipes.xml:167:                     
-"wait for each watch event". [how do you wait?]
-
-recipes.xml:457:          
-<remark>[tbd: myabe helpful to indicate which step this refers to?]</remark>
-
-zookeeperAdmin.xml:77:      
-because requires a majority <remark>[tbd: why?]</remark>, it is best to use...
-
-zookeeperAdmin.xml:112:   
- <screen>$yinst -i jdk-1.6.0.00_3 -br test  <remark>[y! prop - replace with open equiv]</remark></screen>
- 
-zookeeperAdmin.xml:99:         
-- use a maximum heap size of 3GB for a 4GB machine.  <remark>[tbd:  where would they do this? Environment variable, etc?]</remark>
-
-zookeeperAdmin.xml:120
-<screen>$ yinst install -nostart zookeeper_server <remark>[Y! prop - replace with open eq]</remark></screen>
-
-zookeeperAdmin.xml:171:              
-In Java, you can run the following command to execute simple operations:<remark> [tbd: also, maybe give some of those simple operations?]
-
-zookeeperAdmin.xml:194:          
-Running either program gives you a shell in which to execute simple file-system-like operations. <remark>[tbd: again, sample
-          operations?]
-
-zookeeperAdmin.xml:252:       
-If servers use different configuration files,
-care must be taken to ensure that the list of servers in all of the
-standard form, with legal values, etc]</remark>
-
-zookeeperAdmin.xml:408:
-(Note: The system property has no zookeeper
-prefix, and the configuration variable name is different from
-the system property. Yes - it's not consistent, and it's
-annoying.<remark> [tbd: is there any explanation for
-this?]</remark>)
-		
-zookeeperAdmin.xml:445:               When the election algorithm is
-                "0" a UDP port with the same port number as the port listed in
-                the <emphasis role="bold">server.num</emphasis> option will be
-                used. <remark>[tbd: should that be <emphasis
-                role="bold">server.id</emphasis>? Also, why isn't server.id
-                documented anywhere?]</remark>
-		
-zookeeperAdmin.xml:481:                The default to this option is yes, which
-                means that a leader will accept client connections.
-                <remark>[tbd: how do you specifiy which server is the
-                leader?]</remark>
-		
-zookeeperAdmin.xml:495		When the server
-                starts up, it determines which server it is by looking for the
-                file <filename>myid</filename> in the data directory.<remark>
-                [tdb: should we mention somewhere about creating this file,
-                myid, in the setup procedure?]</remark>
-		
-zookeeperAdmin.xml:508:               [tbd: is the next sentence explanation an of what the
-                election port or is it a description of a special case?]
-                </remark>If you want to test multiple servers on a single
-                machine, the individual choices of electionPort for each
-                server can be defined in each server's config files using the
-                line electionPort=xxxx to avoid clashes.
-		
-zookeeperAdmin.xml:524:               If followers fall too far behind a
-                leader, they will be dropped. <remark>[tbd: is this a correct
-                rewording: if followers fall beyond this limit, they are
-                dropped?]</remark>
-		
-zookeeperAdmin.xml:551:               ZooKeeper will not require updates
-                to be synced to the media. <remark>[tbd: useful because...,
-                dangerous because...]</remark>
-		
-zookeeperAdmin.xml:580:                Skips ACL checks. <remark>[tbd: when? where?]</remark>
-                
-zookeeperAdmin.xml:649:        <remark>[tbd: Patrick, Ben, et al: I believe the Message Broker
-        team does perform routine monitoring of Zookeeper. But I might be
-        wrong. To your knowledge, is there any monitoring of a Zookeeper
-        deployment that will a Zookeeper sys admin will want to do, outside of
-        Yahoo?]</remark>
-	
-zookeeperAdmin.xml:755:            Also,
-            the server lists in each Zookeeper server configuration file
-            should be consistent with one another. <remark>[tbd: I'm assuming
-            this last part is true. Is it?]</remark>
-	    
-zookeeperAdmin.xml:812:     For best results, take note of the following list of good
-      Zookeeper practices. <remark>[tbd: I just threw this section in. Do we
-      have list that is is different from the "things to avoid"? If not, I can
-      easily remove this section.]</remark>
-      
-
-zookeeperOver.xml:162:      Ephemeral nodes are useful when you
-      want to implement <remark>[tbd]</remark>.
-      
-zookeeperOver.xml:174:     And if the
-      connection between the client and one of the Zoo Keeper servers is
-      broken, the client will receive a local notification. These can be used
-      to <remark>[tbd]</remark>
-
-zookeeperOver.xml:215:            <para>For more information on these (guarantees), and how they can be used, see
-      <remark>[tbd]</remark></para>
-      
-zookeeperOver.xml:294:           <para><xref linkend="fg_zkComponents" /> shows the high-level components
-      of the ZooKeeper service. With the exception of the request processor,
-      <remark>[tbd: where does the request processor live?]</remark> 
-      
-zookeeperOver.xml:298:      <para><xref linkend="fg_zkComponents" /> shows the high-level components
-      of the ZooKeeper service. With the exception of the request processor,
-     each of
-      the servers that make up the ZooKeeper service replicates its own copy
-      of each of components. <remark>[tbd: I changed the wording in this
-      sentence from the white paper. Can someone please make sure it is still
-      correct?]</remark>
-      
-zookeeperOver.xml:342:      The programming interface to ZooKeeper is deliberately simple.
-      With it, however, you can implement higher order operations, such as
-      synchronizations primitives, group membership, ownership, etc. Some
-      distributed applications have used it to: <remark>[tbd: add uses from
-      white paper and video presentation.]</remark> 
-      
-
-zookeeperProgrammers.xml:94:              <listitem>
-        <para><xref linkend="ch_programStructureWithExample" />
-        <remark>[tbd]</remark></para>
-      </listitem>
-      
-zookeeperProgrammers.xml:115:     Also,
-    the <ulink url="#ch_programStructureWithExample">Simple Programmming
-    Example</ulink> <remark>[tbd]</remark> is helpful for understand the basic
-    structure of a ZooKeeper client application.
-    
-zookeeperProgrammers.xml:142:      The following characters are not
-				allowed  because <remark>[tbd:
-				do we need reasons?]</remark> 
-
-zookeeperProgrammers.xml:172:     If
-      the version it supplies doesn't match the actual version of the data,
-      the update will fail. (This behavior can be overridden. For more
-      information see... )<remark>[tbd... reference here to the section
-      describing the special version number -1]</remark>
-      
-zookeeperProgrammers.xml:197:        More information about watches can be
-        found in the section 
-	<ulink url="recipes.html#sc_recipes_Locks">
-	Zookeeper Watches</ulink>.
-        <remark>[tbd: fix this link] [tbd: Ben there is note from to emphasize
-        that "it is queued". What is "it" and is what we have here
-        sufficient?]</remark></para>
-	
-zookeeperProgrammers.xml:335:    it will send the session id as a part of the connection handshake.
-    As a security measure, the server creates a password for the session id
-    that any ZooKeeper server can validate. <remark>[tbd: note from Ben:
-    "perhaps capability is a better word." need clarification on that.]
-    </remark>
-    
-zookeeperProgrammers.xml:601:              <ulink
-              url="recipes.html#sc_recipes_Locks">Locks</ulink>
-              <remark>[tbd:...]</remark> in <ulink
-              url="recipes.html">Zookeeper Recipes</ulink>.
-              <remark>[tbd:..]</remark>).</para>
-	      
-zookeeperProgrammers.xml:766:             <para>See INSTALL for general information about running
-              <emphasis role="bold">configure</emphasis>. <remark>[tbd: what
-              is INSTALL? a directory? a file?]</remark></para>
-	     
-	      
-	      
-zookeeperProgrammers.xml:813:                <para>To verify that the node's been created:</para>
-
-        <para>You should see a list of node who are children of the root node
-        "/".</para><remark>[tbd: document all the cli commands (I think this is ben's comment)
-
-zookeeperProgrammers.xml:838:                <para>Refer to <xref linkend="ch_programStructureWithExample"/>for examples of usage in Java and C.
-        <remark>[tbd]</remark></para>
-
-zookeeperProgrammers.xml 847: <remark>[tbd: This is a new section. The below
-    is just placeholder. Eventually, a subsection on each of those operations, with a little
-    bit of illustrative code for each op.] </remark>
-    
-zookeeperProgrammers.xml:915:    Program Structure, with Simple Example</title>
-
-zookeeperProgrammers.xml:999:        <term>ZooKeeper Whitepaper <remark>[tbd: find url]</remark></term>
-
-zookeeperProgrammers.xml:1008:        <term>API Reference <remark>[tbd: find url]</remark></term>
-
-zookeeperProgrammers.xml:1062:        [tbd]</remark></term><listitem>
-          <para>Any other good sources anyone can think of...</para>
-        </listitem>
-
-zookeeperStarted.xml:73:            <para>[tbd: should we start w/ a word here about were to get the source,
-      exactly what to download, how to unpack it, and where to put it? Also,
-      does the user need to be in sudo, or can they be under their regular
-      login?]</para>
-      
-zookeeperStarted.xml:84:      <para>This should generate a JAR file called zookeeper.jar. To start
-      Zookeeper, compile and run zookeeper.jar. <emphasis>[tbd, some more
-      instruction here. Perhaps a command line? Are these two steps or
-      one?]</emphasis></para>
-      
-zookeeperStarted.xml:139:      <para>ZooKeeper logs messages using log4j -- more detail available in
-      the <ulink url="zookeeperProgrammers.html#Logging">Logging</ulink>
-      section of the Programmer's Guide.<remark revision="include_tbd">[tbd:
-      real reference needed]</remark> 
-      
-zookeeperStarted.xml:201:      The C bindings exist in two variants: single
-      threaded and multi-threaded. These differ only in how the messaging loop
-      is done. <remark>[tbd: what is the messaging loop? Do we talk about it
-      anywyhere? is this too much info for a getting started guide?]</remark>
-      
-zookeeperStarted.xml:217:      The entry <emphasis
-      role="bold">syncLimit</emphasis> limits how far out of date a server can
-      be from a leader. [TBD: someone please verify that the previous is
-      true.] 
-
-zookeeperStarted.xml:232:	These are the "electionPort" numbers of the servers (as opposed to
-      clientPorts), that is ports for <remark>[tbd: feedback need: what are
-      these ports, exactly?]
-      
-zookeeperStarted.xml:258:          <remark>[tbd: what is the other config param?
-          (I believe two are mentioned above.)]</remark>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/classes/CatalogManager.properties
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/classes/CatalogManager.properties b/src/docs/src/documentation/classes/CatalogManager.properties
deleted file mode 100644
index ac060b9..0000000
--- a/src/docs/src/documentation/classes/CatalogManager.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2002-2004 The Apache Software Foundation
-#
-# Licensed 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.
-
-#=======================================================================
-# CatalogManager.properties
-#
-# This is the default properties file for Apache Forrest.
-# This facilitates local configuration of application-specific catalogs.
-#
-# See the Apache Forrest documentation:
-# http://forrest.apache.org/docs/your-project.html
-# http://forrest.apache.org/docs/validation.html
-
-# verbosity ... level of messages for status/debug
-# See forrest/src/core/context/WEB-INF/cocoon.xconf
-
-# catalogs ... list of additional catalogs to load
-#  (Note that Apache Forrest will automatically load its own default catalog
-#  from src/core/context/resources/schema/catalog.xcat)
-# use full pathnames
-# pathname separator is always semi-colon (;) regardless of operating system
-# directory separator is always slash (/) regardless of operating system
-#
-#catalogs=/home/me/forrest/my-site/src/documentation/resources/schema/catalog.xcat
-catalogs=
-

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/conf/cli.xconf
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/conf/cli.xconf b/src/docs/src/documentation/conf/cli.xconf
deleted file mode 100644
index c671340..0000000
--- a/src/docs/src/documentation/conf/cli.xconf
+++ /dev/null
@@ -1,328 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  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.
--->
-<!--+
-    |  This is the Apache Cocoon command line configuration file.
-    |  Here you give the command line interface details of where
-    |  to find various aspects of your Cocoon installation.
-    |
-    |  If you wish, you can also use this file to specify the URIs
-    |  that you wish to generate.
-    |
-    |  The current configuration information in this file is for
-    |  building the Cocoon documentation. Therefore, all links here
-    |  are relative to the build context dir, which, in the build.xml
-    |  file, is set to ${build.context}
-    |
-    |  Options:
-    |    verbose:            increase amount of information presented
-    |                        to standard output (default: false)
-    |    follow-links:       whether linked pages should also be
-    |                        generated (default: true)
-    |    precompile-only:    precompile sitemaps and XSP pages, but
-    |                        do not generate any pages (default: false)
-    |    confirm-extensions: check the mime type for the generated page
-    |                        and adjust filename and links extensions
-    |                        to match the mime type
-    |                        (e.g. text/html->.html)
-    |
-    |  Note: Whilst using an xconf file to configure the Cocoon
-    |        Command Line gives access to more features, the use of
-    |        command line parameters is more stable, as there are
-    |        currently plans to improve the xconf format to allow
-    |        greater flexibility. If you require a stable and
-    |        consistent method for accessing the CLI, it is recommended
-    |        that you use the command line parameters to configure
-    |        the CLI. See documentation at:
-    |        http://cocoon.apache.org/2.1/userdocs/offline/
-    |        http://wiki.apache.org/cocoon/CommandLine
-    |
-    +-->
-
-<cocoon verbose="true"
-        follow-links="true"
-        precompile-only="false"
-        confirm-extensions="false">
-
-   <!--+
-       |  The context directory is usually the webapp directory
-       |  containing the sitemap.xmap file.
-       |
-       |  The config file is the cocoon.xconf file.
-       |
-       |  The work directory is used by Cocoon to store temporary
-       |  files and cache files.
-       |
-       |  The destination directory is where generated pages will
-       |  be written (assuming the 'simple' mapper is used, see
-       |  below)
-       +-->
-   <context-dir>.</context-dir>
-   <config-file>WEB-INF/cocoon.xconf</config-file>
-   <work-dir>../tmp/cocoon-work</work-dir>
-   <dest-dir>../site</dest-dir>
-
-   <!--+
-       |  A checksum file can be used to store checksums for pages
-       |  as they are generated. When the site is next generated,
-       |  files will not be written if their checksum has not changed.
-       |  This means that it will be easier to detect which files
-       |  need to be uploaded to a server, using the timestamp.
-       |
-       |  The default path is relative to the core webapp directory.
-       |  An asolute path can be used.
-       +-->
-   <!--   <checksums-uri>build/work/checksums</checksums-uri>-->
-
-   <!--+
-       | Broken link reporting options:
-       |   Report into a text file, one link per line:
-       |     <broken-links type="text" report="filename"/>
-       |   Report into an XML file:
-       |     <broken-links type="xml" report="filename"/>
-       |   Ignore broken links (default):
-       |     <broken-links type="none"/>
-       |
-       |   Two attributes to this node specify whether a page should
-       |   be generated when an error has occurred. 'generate' specifies
-       |   whether a page should be generated (default: true) and
-       |   extension specifies an extension that should be appended
-       |   to the generated page's filename (default: none)
-       |
-       |   Using this, a quick scan through the destination directory
-       |   will show broken links, by their filename extension.
-       +-->
-   <broken-links type="xml"
-                 file="../brokenlinks.xml"
-                 generate="false"
-                 extension=".error"
-                 show-referrers="true"/>
-
-   <!--+
-       |  Load classes at startup. This is necessary for generating
-       |  from sites that use SQL databases and JDBC.
-       |  The <load-class> element can be repeated if multiple classes
-       |  are needed.
-       +-->
-   <!--
-   <load-class>org.firebirdsql.jdbc.Driver</load-class>
-   -->
-
-   <!--+
-       |  Configures logging.
-       |  The 'log-kit' parameter specifies the location of the log kit
-       |  configuration file (usually called logkit.xconf.
-       |
-       |  Logger specifies the logging category (for all logging prior
-       |  to other Cocoon logging categories taking over)
-       |
-       |  Available log levels are:
-       |    DEBUG:        prints all level of log messages.
-       |    INFO:         prints all level of log messages except DEBUG
-       |                  ones.
-       |    WARN:         prints all level of log messages except DEBUG
-       |                  and INFO ones.
-       |    ERROR:        prints all level of log messages except DEBUG,
-       |                  INFO and WARN ones.
-       |    FATAL_ERROR:  prints only log messages of this level
-       +-->
-   <!-- <logging log-kit="WEB-INF/logkit.xconf" logger="cli" level="ERROR" /> -->
-
-   <!--+
-       |  Specifies the filename to be appended to URIs that
-       |  refer to a directory (i.e. end with a forward slash).
-       +-->
-   <default-filename>index.html</default-filename>
-
-   <!--+
-       |  Specifies a user agent string to the sitemap when
-       |  generating the site.
-       |
-       |  A generic term for a web browser is "user agent". Any
-       |  user agent, when connecting to a web server, will provide
-       |  a string to identify itself (e.g. as Internet Explorer or
-       |  Mozilla). It is possible to have Cocoon serve different
-       |  content depending upon the user agent string provided by
-       |  the browser. If your site does this, then you may want to
-       |  use this <user-agent> entry to provide a 'fake' user agent
-       |  to Cocoon, so that it generates the correct version of your
-       |  site.
-       |
-       |  For most sites, this can be ignored.
-       +-->
-   <!--
-   <user-agent>Cocoon Command Line Environment 2.1</user-agent>
-   -->
-
-   <!--+
-       |  Specifies an accept string to the sitemap when generating
-       |  the site.
-       |  User agents can specify to an HTTP server what types of content
-       |  (by mime-type) they are able to receive. E.g. a browser may be
-       |  able to handle jpegs, but not pngs. The HTTP accept header
-       |  allows the server to take the browser's capabilities into account,
-       |  and only send back content that it can handle.
-       |
-       |  For most sites, this can be ignored.
-       +-->
-
-   <accept>*/*</accept>
-
-   <!--+
-       | Specifies which URIs should be included or excluded, according
-       | to wildcard patterns.
-       |
-       | These includes/excludes are only relevant when you are following
-       | links. A link URI must match an include pattern (if one is given)
-       | and not match an exclude pattern, if it is to be followed by
-       | Cocoon. It can be useful, for example, where there are links in
-       | your site to pages that are not generated by Cocoon, such as
-       | references to api-documentation.
-       |
-       | By default, all URIs are included. If both include and exclude
-       | patterns are specified, a URI is first checked against the
-       | include patterns, and then against the exclude patterns.
-       |
-       | Multiple patterns can be given, using muliple include or exclude
-       | nodes.
-       |
-       | The order of the elements is not significant, as only the first
-       | successful match of each category is used.
-       |
-       | Currently, only the complete source URI can be matched (including
-       | any URI prefix). Future plans include destination URI matching
-       | and regexp matching. If you have requirements for these, contact
-       | dev@cocoon.apache.org.
-       +-->
-
-   <exclude pattern="**/"/>
-   <exclude pattern="**apidocs**"/>
-   <exclude pattern="api/**"/>
-
-   <!-- ZOOKEEPER-2364 - we build our own release notes separately -->
-   <exclude pattern="releasenotes.**"/>
-
-<!--
-  This is a workaround for FOR-284 "link rewriting broken when
-  linking to xml source views which contain site: links".
-  See the explanation there and in declare-broken-site-links.xsl
--->
-   <exclude pattern="site:**"/>
-   <exclude pattern="ext:**"/>
-   <exclude pattern="lm:**"/>
-   <exclude pattern="**/site:**"/>
-   <exclude pattern="**/ext:**"/>
-   <exclude pattern="**/lm:**"/>
-
-   <!-- Exclude tokens used in URLs to ASF mirrors (interpreted by a CGI) -->
-   <exclude pattern="[preferred]/**"/>
-   <exclude pattern="[location]"/>
-
-   <!--   <include-links extension=".html"/>-->
-
-   <!--+
-       |  <uri> nodes specify the URIs that should be generated, and
-       |  where required, what should be done with the generated pages.
-       |  They describe the way the URI of the generated file is created
-       |  from the source page's URI. There are three ways that a generated
-       |  file URI can be created: append, replace and insert.
-       |
-       |  The "type" attribute specifies one of (append|replace|insert):
-       |
-       |  append:
-       |  Append the generated page's URI to the end of the source URI:
-       |
-       |   <uri type="append" src-prefix="documents/" src="index.html"
-       |   dest="build/dest/"/>
-       |
-       |  This means that
-       |   (1) the "documents/index.html" page is generated
-       |   (2) the file will be written to "build/dest/documents/index.html"
-       |
-       |  replace:
-       |  Completely ignore the generated page's URI - just
-       |  use the destination URI:
-       |
-       |   <uri type="replace" src-prefix="documents/" src="index.html"
-       |   dest="build/dest/docs.html"/>
-       |
-       |  This means that
-       |   (1) the "documents/index.html" page is generated
-       |   (2) the result is written to "build/dest/docs.html"
-       |   (3) this works only for "single" pages - and not when links
-       |       are followed
-       |
-       |  insert:
-       |  Insert generated page's URI into the destination
-       |  URI at the point marked with a * (example uses fictional
-       |  zip protocol)
-       |
-       |   <uri type="insert" src-prefix="documents/" src="index.html"
-       |   dest="zip://*.zip/page.html"/>
-       |
-       |  This means that
-       |   (1)
-       |
-       |  In any of these scenarios, if the dest attribute is omitted,
-       |  the value provided globally using the <dest-dir> node will
-       |  be used instead.
-       +-->
-   <!--
-   <uri type="replace"
-        src-prefix="samples/"
-        src="hello-world/hello.html"
-        dest="build/dest/hello-world.html"/>
-   -->
-
-   <!--+
-       | <uri> nodes can be grouped together in a <uris> node. This
-       | enables a group of URIs to share properties. The following
-       | properties can be set for a group of URIs:
-       |   * follow-links:       should pages be crawled for links
-       |   * confirm-extensions: should file extensions be checked
-       |                         for the correct mime type
-       |   * src-prefix:         all source URIs should be
-       |                         pre-pended with this prefix before
-       |                         generation. The prefix is not
-       |                         included when calculating the
-       |                         destination URI
-       |   * dest:               the base destination URI to be
-       |                         shared by all pages in this group
-       |   * type:               the method to be used to calculate
-       |                         the destination URI. See above
-       |                         section on <uri> node for details.
-       |
-       | Each <uris> node can have a name attribute. When a name
-       | attribute has been specified, the -n switch on the command
-       | line can be used to tell Cocoon to only process the URIs
-       | within this URI group. When no -n switch is given, all
-       | <uris> nodes are processed. Thus, one xconf file can be
-       | used to manage multiple sites.
-       +-->
-   <!--
-   <uris name="mirrors" follow-links="false">
-     <uri type="append" src="mirrors.html"/>
-   </uris>
-   -->
-
-   <!--+
-       |  File containing URIs (plain text, one per line).
-       +-->
-   <!--
-   <uri-file>uris.txt</uri-file>
-   -->
-</cocoon>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/index.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/index.xml b/src/docs/src/documentation/content/xdocs/index.xml
deleted file mode 100644
index 969e482..0000000
--- a/src/docs/src/documentation/content/xdocs/index.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
-
-<document>
-  
-  <header>
-    <title>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</title>
-  </header>
-  
-  <body>
-    <p>ZooKeeper is a high-performance coordination service for
-      distributed applications.  It exposes common services - such as
-      naming, configuration management, synchronization, and group
-      services - in a simple interface so you don't have to write them
-      from scratch.  You can use it off-the-shelf to implement
-      consensus, group management, leader election, and presence
-      protocols. And you can build on it for your own, specific needs.
-    </p>
-
-    <p>
-      The following documents describe concepts and procedures to get
-      you started using ZooKeeper. If you have more questions, please
-      ask the <a href="ext:lists">mailing list</a> or browse the
-      archives.
-    </p>
-    <ul>
-
-      <li><strong>ZooKeeper Overview</strong><p>Technical Overview Documents for Client Developers, Adminstrators, and Contributors</p>
-      <ul><li><a href="zookeeperOver.html">Overview</a> - a bird's eye view of ZooKeeper, including design concepts and architecture</li>
-      <li><a href="zookeeperStarted.html">Getting Started</a> - a tutorial-style guide for developers to install, run, and program to ZooKeeper</li>
-      <li><a href="ext:relnotes">Release Notes</a> - new developer and user facing features, improvements, and incompatibilities</li>
-      </ul>
-      </li>
-      
-      <li><strong>Developers</strong><p> Documents for Developers using the ZooKeeper Client API</p>
-      <ul>
-            <li><a href="ext:api/index">API Docs</a> - the technical reference to ZooKeeper Client APIs</li>
-      <li><a href="zookeeperProgrammers.html">Programmer's Guide</a> - a client application developer's guide to ZooKeeper</li>
-      <li><a href="javaExample.html">ZooKeeper Java Example</a> - a simple Zookeeper client appplication, written in Java</li>
-      <li><a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> - sample implementations of barriers and queues</li>  
-      <li><a href="recipes.html">ZooKeeper Recipes</a> - higher level solutions to common problems in distributed applications</li>
-      </ul>
-      </li>
-      
-      <li><strong>Administrators &amp; Operators</strong> <p> Documents for Administrators and Operations Engineers of ZooKeeper Deployments</p>
-      <ul>
-      <li><a href="zookeeperAdmin.html">Administrator's Guide</a> - a guide for system administrators and anyone else who might deploy ZooKeeper</li>
-      <li><a href="zookeeperQuotas.html">Quota Guide</a> - a guide for system administrators on Quotas in ZooKeeper. </li>
-      <li><a href="zookeeperJMX.html">JMX</a> - how to enable JMX in ZooKeeper</li>
-      <li><a href="zookeeperHierarchicalQuorums.html">Hierarchical quorums</a></li>
-      <li><a href="zookeeperObservers.html">Observers</a> - non-voting ensemble members that easily improve ZooKeeper's scalability</li>
-      <li><a href="zookeeperReconfig.html">Dynamic Reconfiguration</a> - a guide on how to use dynamic reconfiguration in ZooKeeper</li>
-      </ul>
-      </li>
-      
-      <li><strong>Contributors</strong><p> Documents for Developers Contributing to the ZooKeeper Open Source Project</p>
-      <ul>
-      <li><a href="zookeeperInternals.html">ZooKeeper Internals</a> - assorted topics on the inner workings of ZooKeeper</li>
-      </ul>
-      </li>
-      
-      <li><strong>Miscellaneous ZooKeeper Documentation</strong>
-      <ul>
-      <li><a href="ext:wiki">Wiki</a></li>
-      <li><a href="ext:faq">FAQ</a></li>    
-      </ul>
-      </li>
-    </ul>
-  </body>
-  
-</document>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/javaExample.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/javaExample.xml b/src/docs/src/documentation/content/xdocs/javaExample.xml
deleted file mode 100644
index 16f7795..0000000
--- a/src/docs/src/documentation/content/xdocs/javaExample.xml
+++ /dev/null
@@ -1,664 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="ar_JavaExample">
-  <title>ZooKeeper Java Example</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This article contains sample Java code for a simple watch client.</para>
-
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_Introduction">
-    <title>A Simple Watch Client</title>
-
-    <para>To introduce you to the ZooKeeper Java API, we develop here a very simple 
-    watch client. This ZooKeeper client watches a ZooKeeper node for changes 
-    and responds to by starting or stopping a program.</para>
-    
-    <section id="sc_requirements"><title>Requirements</title>
-    
-    <para>The client has four requirements:</para>
-    
-    <itemizedlist><listitem><para>It takes as parameters:</para>
-        <itemizedlist>
-        <listitem><para>the address of the ZooKeeper service</para></listitem>
-        <listitem><para>the name of a znode - the one to be watched</para></listitem>
-        <listitem><para>the name of a file to write the output to</para></listitem>
-        <listitem><para>an executable with arguments.</para></listitem></itemizedlist></listitem>
-    <listitem><para>It fetches the data associated with the znode and starts the executable.</para></listitem>
-    <listitem><para>If the znode changes, the client refetches the contents and restarts the executable.</para></listitem>
-    <listitem><para>If the znode disappears, the client kills the executable.</para></listitem></itemizedlist>
-
-   </section>
-   
-   <section id="sc_design">
-   	<title>Program Design</title>
-
-   <para>Conventionally, ZooKeeper applications are broken into two units, one which maintains the connection, 
-   and the other which monitors data.  In this application, the class called the <emphasis role="bold">Executor</emphasis> 
-   maintains the ZooKeeper connection, and the class called the  <emphasis role="bold">DataMonitor</emphasis> monitors the data
-   in the ZooKeeper tree. Also, Executor contains the main thread and contains the execution logic.
-   It is responsible for what little user interaction there is, as well as interaction with the exectuable program you
-   pass in as an argument and which the sample (per the requirements) shuts down and restarts, according to the 
-   state of the znode.</para>
-   
-   </section>
-  
-   </section>
-
-   <section id="sc_executor"><title>The Executor Class</title>
-    <para>The Executor object is the primary container of the sample application. It contains 
-    both the <emphasis role="bold">ZooKeeper</emphasis> object, <emphasis role="bold">DataMonitor</emphasis>, as described above in 
-    <xref linkend="sc_design"/>.  </para>
-    
-    <programlisting>
-    // from the Executor class...
-    
-    public static void main(String[] args) {
-        if (args.length &lt; 4) {
-            System.err
-                    .println("USAGE: Executor hostPort znode filename program [args ...]");
-            System.exit(2);
-        }
-        String hostPort = args[0];
-        String znode = args[1];
-        String filename = args[2];
-        String exec[] = new String[args.length - 3];
-        System.arraycopy(args, 3, exec, 0, exec.length);
-        try {
-            new Executor(hostPort, znode, filename, exec).run();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public Executor(String hostPort, String znode, String filename,
-            String exec[]) throws KeeperException, IOException {
-        this.filename = filename;
-        this.exec = exec;
-        zk = new ZooKeeper(hostPort, 3000, this);
-        dm = new DataMonitor(zk, znode, null, this);
-    }
-
-    public void run() {
-        try {
-            synchronized (this) {
-                while (!dm.dead) {
-                    wait();
-                }
-            }
-        } catch (InterruptedException e) {
-        }
-    }
-</programlisting>
-
-
-    <para>
-    Recall that the Executor's job is to start and stop the executable whose name you pass in on the command line. 
-    It does this in response to events fired by the ZooKeeper object. As you can see in the code above, the Executor passes
-    a reference to itself as the Watcher argument in the ZooKeeper constructor. It also passes a reference to itself
-    as DataMonitorListener argument to the DataMonitor constructor. Per the Executor's definition, it implements both these
-    interfaces:
-    </para>
-    
-    <programlisting>
-public class Executor implements Watcher, Runnable, DataMonitor.DataMonitorListener {
-...</programlisting>
-    
-    <para>The <emphasis role="bold">Watcher</emphasis> interface is defined by the ZooKeeper Java API.
-    ZooKeeper uses it to communicate back to its container. It supports only one method, <command>process()</command>, and ZooKeeper uses 
-    it to communciates generic events that the main thread would be intersted in, such as the state of the ZooKeeper connection or the ZooKeeper session.The Executor 
-    in this example simply forwards those events down to the DataMonitor to decide what to do with them. It does this simply to illustrate
-    the point that, by convention, the Executor or some Executor-like object "owns" the ZooKeeper connection, but it is free to delegate the events to other
-    events to other objects. It also uses this as the default channel on which to fire watch events. (More on this later.)</para>
-    
-<programlisting>
-    public void process(WatchedEvent event) {
-        dm.process(event);
-    }
-</programlisting>
-    
-    <para>The <emphasis role="bold">DataMonitorListener</emphasis> 
-    interface, on the other hand, is not part of the the ZooKeeper API. It is a completely custom interface, 
-    designed for this sample application. The DataMonitor object uses it to communicate back to its container, which
-    is also the the Executor object.The DataMonitorListener interface looks like this:</para>
-    <programlisting>
-public interface DataMonitorListener {
-    /**
-    * The existence status of the node has changed.
-    */
-    void exists(byte data[]);
-
-    /**
-    * The ZooKeeper session is no longer valid.
-    * 
-    * @param rc
-    * the ZooKeeper reason code
-    */
-    void closing(int rc);
-}
-</programlisting>
-    <para>This interface is defined in the DataMonitor class and implemented in the Executor class. 
-    When <command>Executor.exists()</command> is invoked,
-    the Executor decides whether to start up or shut down per the requirements. Recall that the requires say to kill the executable when the 
-    znode ceases to <emphasis>exist</emphasis>. </para>
-    
-    <para>When <command>Executor.closing()</command>
-    is invoked, the Executor decides whether or not to shut itself down in response to the ZooKeeper connection permanently disappearing.</para>
-    
-    <para>As you might have guessed, DataMonitor is the object that invokes 
-    these methods, in response to changes in ZooKeeper's state.</para>
-    
-    <para>Here are Executor's implementation of 
-    <command>DataMonitorListener.exists()</command> and <command>DataMonitorListener.closing</command>:
-    </para>
-    <programlisting>
-public void exists( byte[] data ) {
-    if (data == null) {
-        if (child != null) {
-            System.out.println("Killing process");
-            child.destroy();
-            try {
-                child.waitFor();
-            } catch (InterruptedException e) {
-            }
-        }
-        child = null;
-    } else {
-        if (child != null) {
-            System.out.println("Stopping child");
-            child.destroy();
-            try {
-               child.waitFor();
-            } catch (InterruptedException e) {
-            e.printStackTrace();
-            }
-        }
-        try {
-            FileOutputStream fos = new FileOutputStream(filename);
-            fos.write(data);
-            fos.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        try {
-            System.out.println("Starting child");
-            child = Runtime.getRuntime().exec(exec);
-            new StreamWriter(child.getInputStream(), System.out);
-            new StreamWriter(child.getErrorStream(), System.err);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-}
-
-public void closing(int rc) {
-    synchronized (this) {
-        notifyAll();
-    }
-}
-</programlisting>
-    
-</section>
-<section id="sc_DataMonitor"><title>The DataMonitor Class</title>
-<para>
-The DataMonitor class has the meat of the ZooKeeper logic. It is mostly 
-asynchronous and event driven. DataMonitor kicks things off in the constructor with:</para>
-<programlisting>
-public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher,
-        DataMonitorListener listener) {
-    this.zk = zk;
-    this.znode = znode;
-    this.chainedWatcher = chainedWatcher;
-    this.listener = listener;
-    
-    // Get things started by checking if the node exists. We are going
-    // to be completely event driven
-    <emphasis role="bold">zk.exists(znode, true, this, null);</emphasis>
-}
-</programlisting>
-
-<para>The call to <command>ZooKeeper.exists()</command> checks for the existence of the znode, 
-sets a watch, and passes a reference to itself (<command>this</command>)
-as the completion callback object. In this sense, it kicks things off, since the
-real processing happens when the watch is triggered.</para>
-
-<note>
-<para>Don't confuse the completion callback with the watch callback. The <command>ZooKeeper.exists()</command> 
-completion callback, which happens to be the method <command>StatCallback.processResult()</command> implemented 
-in the DataMonitor object, is invoked when the asynchronous <emphasis>setting of the watch</emphasis> operation 
-(by <command>ZooKeeper.exists()</command>) completes on the server. </para>
-<para>
-The triggering of the watch, on the other hand, sends an event to the <emphasis>Executor</emphasis> object, since
-the Executor registered as the Watcher of the ZooKeeper object.</para>
-
-<para>As an aside, you might note that the DataMonitor could also register itself as the Watcher
-for this particular watch event. This is new to ZooKeeper 3.0.0 (the support of multiple Watchers). In this
-example, however, DataMonitor does not register as the Watcher.</para>
-</note>
-
-<para>When the <command>ZooKeeper.exists()</command> operation completes on the server, the ZooKeeper API invokes this completion callback on 
-the client:</para>
-
-<programlisting>
-public void processResult(int rc, String path, Object ctx, Stat stat) {
-    boolean exists;
-    switch (rc) {
-    case Code.Ok:
-        exists = true;
-        break;
-    case Code.NoNode:
-        exists = false;
-        break;
-    case Code.SessionExpired:
-    case Code.NoAuth:
-        dead = true;
-        listener.closing(rc);
-        return;
-    default:
-        // Retry errors
-        zk.exists(znode, true, this, null);
-        return;
-    }
- 
-    byte b[] = null;
-    if (exists) {
-        try {
-            <emphasis role="bold">b = zk.getData(znode, false, null);</emphasis>
-        } catch (KeeperException e) {
-            // We don't need to worry about recovering now. The watch
-            // callbacks will kick off any exception handling
-            e.printStackTrace();
-        } catch (InterruptedException e) {
-            return;
-        }
-    }     
-    if ((b == null &amp;&amp; b != prevData)
-            || (b != null &amp;&amp; !Arrays.equals(prevData, b))) {
-        <emphasis role="bold">listener.exists(b);</emphasis>
-        prevData = b;
-    }
-}
-</programlisting>
-
-<para>
-The code first checks the error codes for znode existence, fatal errors, and 
-recoverable errors. If the file (or znode) exists, it gets the data from the znode, and 
-then invoke the exists() callback of Executor if the state has changed. Note, 
-it doesn't have to do any Exception processing for the getData call because it 
-has watches pending for anything that could cause an error: if the node is deleted 
-before it calls <command>ZooKeeper.getData()</command>, the watch event set by 
-the <command>ZooKeeper.exists()</command> triggers a callback; 
-if there is a communication error, a connection watch event fires when 
-the connection comes back up.
-</para>
-
-<para>Finally, notice how DataMonitor processes watch events: </para>
-<programlisting>
-    public void process(WatchedEvent event) {
-        String path = event.getPath();
-        if (event.getType() == Event.EventType.None) {
-            // We are are being told that the state of the
-            // connection has changed
-            switch (event.getState()) {
-            case SyncConnected:
-                // In this particular example we don't need to do anything
-                // here - watches are automatically re-registered with 
-                // server and any watches triggered while the client was 
-                // disconnected will be delivered (in order of course)
-                break;
-            case Expired:
-                // It's all over
-                dead = true;
-                listener.closing(KeeperException.Code.SessionExpired);
-                break;
-            }
-        } else {
-            if (path != null &amp;&amp; path.equals(znode)) {
-                // Something has changed on the node, let's find out
-                zk.exists(znode, true, this, null);
-            }
-        }
-        if (chainedWatcher != null) {
-            chainedWatcher.process(event);
-        }
-    }
-</programlisting>
-<para>
-If the client-side ZooKeeper libraries can re-establish the
-communication channel (SyncConnected event) to ZooKeeper before
-session expiration (Expired event) all of the session's watches will
-automatically be re-established with the server (auto-reset of watches
-is new in ZooKeeper 3.0.0). See <ulink
-url="zookeeperProgrammers.html#ch_zkWatches">ZooKeeper Watches</ulink>
-in the programmer guide for more on this. A bit lower down in this
-function, when DataMonitor gets an event for a znode, it calls
-<command>ZooKeeper.exists()</command> to find out what has changed.
-</para>
-</section>
-
-<section id="sc_completeSourceCode">
-	<title>Complete Source Listings</title>
-	<example id="eg_Executor_java"><title>Executor.java</title><programlisting>
-/**
- * A simple example program to use DataMonitor to start and
- * stop executables based on a znode. The program watches the
- * specified znode and saves the data that corresponds to the
- * znode in the filesystem. It also starts the specified program
- * with the specified arguments when the znode exists and kills
- * the program if the znode goes away.
- */
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-
-public class Executor
-    implements Watcher, Runnable, DataMonitor.DataMonitorListener
-{
-    String znode;
-
-    DataMonitor dm;
-
-    ZooKeeper zk;
-
-    String filename;
-
-    String exec[];
-
-    Process child;
-
-    public Executor(String hostPort, String znode, String filename,
-            String exec[]) throws KeeperException, IOException {
-        this.filename = filename;
-        this.exec = exec;
-        zk = new ZooKeeper(hostPort, 3000, this);
-        dm = new DataMonitor(zk, znode, null, this);
-    }
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-        if (args.length &lt; 4) {
-            System.err
-                    .println("USAGE: Executor hostPort znode filename program [args ...]");
-            System.exit(2);
-        }
-        String hostPort = args[0];
-        String znode = args[1];
-        String filename = args[2];
-        String exec[] = new String[args.length - 3];
-        System.arraycopy(args, 3, exec, 0, exec.length);
-        try {
-            new Executor(hostPort, znode, filename, exec).run();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /***************************************************************************
-     * We do process any events ourselves, we just need to forward them on.
-     *
-     * @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.proto.WatcherEvent)
-     */
-    public void process(WatchedEvent event) {
-        dm.process(event);
-    }
-
-    public void run() {
-        try {
-            synchronized (this) {
-                while (!dm.dead) {
-                    wait();
-                }
-            }
-        } catch (InterruptedException e) {
-        }
-    }
-
-    public void closing(int rc) {
-        synchronized (this) {
-            notifyAll();
-        }
-    }
-
-    static class StreamWriter extends Thread {
-        OutputStream os;
-
-        InputStream is;
-
-        StreamWriter(InputStream is, OutputStream os) {
-            this.is = is;
-            this.os = os;
-            start();
-        }
-
-        public void run() {
-            byte b[] = new byte[80];
-            int rc;
-            try {
-                while ((rc = is.read(b)) > 0) {
-                    os.write(b, 0, rc);
-                }
-            } catch (IOException e) {
-            }
-
-        }
-    }
-
-    public void exists(byte[] data) {
-        if (data == null) {
-            if (child != null) {
-                System.out.println("Killing process");
-                child.destroy();
-                try {
-                    child.waitFor();
-                } catch (InterruptedException e) {
-                }
-            }
-            child = null;
-        } else {
-            if (child != null) {
-                System.out.println("Stopping child");
-                child.destroy();
-                try {
-                    child.waitFor();
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-            try {
-                FileOutputStream fos = new FileOutputStream(filename);
-                fos.write(data);
-                fos.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            try {
-                System.out.println("Starting child");
-                child = Runtime.getRuntime().exec(exec);
-                new StreamWriter(child.getInputStream(), System.out);
-                new StreamWriter(child.getErrorStream(), System.err);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-}
-</programlisting>
-	
-</example>
-
-<example id="eg_DataMonitor_java">
-	<title>DataMonitor.java</title>
-	<programlisting>
-/**
- * A simple class that monitors the data and existence of a ZooKeeper
- * node. It uses asynchronous ZooKeeper APIs.
- */
-import java.util.Arrays;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.AsyncCallback.StatCallback;
-import org.apache.zookeeper.KeeperException.Code;
-import org.apache.zookeeper.data.Stat;
-
-public class DataMonitor implements Watcher, StatCallback {
-
-    ZooKeeper zk;
-
-    String znode;
-
-    Watcher chainedWatcher;
-
-    boolean dead;
-
-    DataMonitorListener listener;
-
-    byte prevData[];
-
-    public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher,
-            DataMonitorListener listener) {
-        this.zk = zk;
-        this.znode = znode;
-        this.chainedWatcher = chainedWatcher;
-        this.listener = listener;
-        // Get things started by checking if the node exists. We are going
-        // to be completely event driven
-        zk.exists(znode, true, this, null);
-    }
-
-    /**
-     * Other classes use the DataMonitor by implementing this method
-     */
-    public interface DataMonitorListener {
-        /**
-         * The existence status of the node has changed.
-         */
-        void exists(byte data[]);
-
-        /**
-         * The ZooKeeper session is no longer valid.
-         *
-         * @param rc
-         *                the ZooKeeper reason code
-         */
-        void closing(int rc);
-    }
-
-    public void process(WatchedEvent event) {
-        String path = event.getPath();
-        if (event.getType() == Event.EventType.None) {
-            // We are are being told that the state of the
-            // connection has changed
-            switch (event.getState()) {
-            case SyncConnected:
-                // In this particular example we don't need to do anything
-                // here - watches are automatically re-registered with 
-                // server and any watches triggered while the client was 
-                // disconnected will be delivered (in order of course)
-                break;
-            case Expired:
-                // It's all over
-                dead = true;
-                listener.closing(KeeperException.Code.SessionExpired);
-                break;
-            }
-        } else {
-            if (path != null &amp;&amp; path.equals(znode)) {
-                // Something has changed on the node, let's find out
-                zk.exists(znode, true, this, null);
-            }
-        }
-        if (chainedWatcher != null) {
-            chainedWatcher.process(event);
-        }
-    }
-
-    public void processResult(int rc, String path, Object ctx, Stat stat) {
-        boolean exists;
-        switch (rc) {
-        case Code.Ok:
-            exists = true;
-            break;
-        case Code.NoNode:
-            exists = false;
-            break;
-        case Code.SessionExpired:
-        case Code.NoAuth:
-            dead = true;
-            listener.closing(rc);
-            return;
-        default:
-            // Retry errors
-            zk.exists(znode, true, this, null);
-            return;
-        }
-
-        byte b[] = null;
-        if (exists) {
-            try {
-                b = zk.getData(znode, false, null);
-            } catch (KeeperException e) {
-                // We don't need to worry about recovering now. The watch
-                // callbacks will kick off any exception handling
-                e.printStackTrace();
-            } catch (InterruptedException e) {
-                return;
-            }
-        }
-        if ((b == null &amp;&amp; b != prevData)
-                || (b != null &amp;&amp; !Arrays.equals(prevData, b))) {
-            listener.exists(b);
-            prevData = b;
-        }
-    }
-}
-</programlisting>
-</example>
-</section>
-
-
-
-</article>


[03/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperProgrammers.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
new file mode 100644
index 0000000..a2a978f
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperProgrammers.xml
@@ -0,0 +1,2008 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_programmersGuide">
+  <title>ZooKeeper Programmer's Guide</title>
+
+  <subtitle>Developing Distributed Applications that use ZooKeeper</subtitle>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This guide contains detailed information about creating
+      distributed applications that use ZooKeeper. It discusses the basic
+      operations ZooKeeper supports, and how these can be used to build
+      higher-level abstractions. It contains solutions to common tasks, a
+      troubleshooting guide, and links to other information.</para>
+
+      <para>$Revision: 1.14 $ $Date: 2008/09/19 05:31:45 $</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="_introduction">
+    <title>Introduction</title>
+
+    <para>This document is a guide for developers wishing to create
+    distributed applications that take advantage of ZooKeeper's coordination
+    services. It contains conceptual and practical information.</para>
+
+    <para>The first four sections of this guide present higher level
+    discussions of various ZooKeeper concepts. These are necessary both for an
+    understanding of how ZooKeeper works as well how to work with it. It does
+    not contain source code, but it does assume a familiarity with the
+    problems associated with distributed computing. The sections in this first
+    group are:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><xref linkend="ch_zkDataModel" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_zkSessions" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_zkWatches" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_zkGuarantees" /></para>
+      </listitem>
+    </itemizedlist>
+
+    <para>The next four sections provide practical programming
+    information. These are:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><xref linkend="ch_guideToZkOperations" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_bindings" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_programStructureWithExample" />
+        <emphasis>[tbd]</emphasis></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="ch_gotchas" /></para>
+      </listitem>
+    </itemizedlist>
+
+    <para>The book concludes with an <ulink
+    url="#apx_linksToOtherInfo">appendix</ulink> containing links to other
+    useful, ZooKeeper-related information.</para>
+
+    <para>Most of information in this document is written to be accessible as
+    stand-alone reference material. However, before starting your first
+    ZooKeeper application, you should probably at least read the chaptes on
+    the <ulink url="#ch_zkDataModel">ZooKeeper Data Model</ulink> and <ulink
+    url="#ch_guideToZkOperations">ZooKeeper Basic Operations</ulink>. Also,
+    the <ulink url="#ch_programStructureWithExample">Simple Programmming
+    Example</ulink> <emphasis>[tbd]</emphasis> is helpful for understanding the basic
+    structure of a ZooKeeper client application.</para>
+  </section>
+
+  <section id="ch_zkDataModel">
+    <title>The ZooKeeper Data Model</title>
+
+    <para>ZooKeeper has a hierarchal name space, much like a distributed file
+    system. The only difference is that each node in the namespace can have
+    data associated with it as well as children. It is like having a file
+    system that allows a file to also be a directory. Paths to nodes are
+    always expressed as canonical, absolute, slash-separated paths; there are
+    no relative reference. Any unicode character can be used in a path subject
+    to the following constraints:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para>The null character (\u0000) cannot be part of a path name. (This
+        causes problems with the C binding.)</para>
+      </listitem>
+
+      <listitem>
+        <para>The following characters can't be used because they don't
+        display well, or render in confusing ways: \u0001 - \u001F and \u007F
+        - \u009F.</para>
+      </listitem>
+
+      <listitem>
+        <para>The following characters are not allowed: \ud800 - uF8FF,
+        \uFFF0 - uFFFF.</para>
+      </listitem>
+
+      <listitem>
+        <para>The "." character can be used as part of another name, but "."
+        and ".." cannot alone be used to indicate a node along a path,
+        because ZooKeeper doesn't use relative paths. The following would be
+        invalid: "/a/b/./c" or "/a/b/../c".</para>
+      </listitem>
+
+      <listitem>
+        <para>The token "zookeeper" is reserved.</para>
+      </listitem>
+    </itemizedlist>
+
+    <section id="sc_zkDataModel_znodes">
+      <title>ZNodes</title>
+
+      <para>Every node in a ZooKeeper tree is referred to as a
+      <emphasis>znode</emphasis>. Znodes maintain a stat structure that
+      includes version numbers for data changes, acl changes. The stat
+      structure also has timestamps. The version number, together with the
+      timestamp, allows ZooKeeper to validate the cache and to coordinate
+      updates. Each time a znode's data changes, the version number increases.
+      For instance, whenever a client retrieves data, it also receives the
+      version of the data. And when a client performs an update or a delete,
+      it must supply the version of the data of the znode it is changing. If
+      the version it supplies doesn't match the actual version of the data,
+      the update will fail. (This behavior can be overridden. For more
+      information see... )<emphasis>[tbd...]</emphasis></para>
+
+      <note>
+        <para>In distributed application engineering, the word
+        <emphasis>node</emphasis> can refer to a generic host machine, a
+        server, a member of an ensemble, a client process, etc. In the ZooKeeper
+        documentation, <emphasis>znodes</emphasis> refer to the data nodes.
+        <emphasis>Servers</emphasis>  refer to machines that make up the
+        ZooKeeper service; <emphasis>quorum peers</emphasis> refer to the
+        servers that make up an ensemble; client refers to any host or process
+        which uses a ZooKeeper service.</para>
+      </note>
+
+      <para>Znodes are the main enitity that a programmer access. They have
+      several characteristics that are worth mentioning here.</para>
+
+      <section id="sc_zkDataMode_watches">
+        <title>Watches</title>
+
+        <para>Clients can set watches on znodes. Changes to that znode trigger
+        the watch and then clear the watch. When a watch triggers, ZooKeeper
+        sends the client a notification. More information about watches can be
+        found in the section 
+	    <ulink url="#ch_zkWatches">ZooKeeper Watches</ulink>.</para>
+      </section>
+
+      <section>
+        <title>Data Access</title>
+
+        <para>The data stored at each znode in a namespace is read and written
+        atomically. Reads get all the data bytes associated with a znode and a
+        write replaces all the data. Each node has an Access Control List
+        (ACL) that restricts who can do what.</para>
+        
+        <para>ZooKeeper was not designed to be a general database or large
+        object store. Instead, it manages coordination data. This data can
+        come in the form of configuration, status information, rendezvous, etc.
+        A common property of the various forms of coordination data is that
+        they are relatively small: measured in kilobytes.
+        The ZooKeeper client and the server implementations have sanity checks
+        to ensure that znodes have less than 1M of data, but the data should
+        be much less than that on average. Operating on relatively large data
+        sizes will cause some operations to take much more time than others and
+        will affect the latencies of some operations because of the extra time
+        needed to move more data over the network and onto storage media. If
+        large data storage is needed, the usually pattern of dealing with such
+        data is to store it on a bulk storage system, such as NFS or HDFS, and
+        store pointers to the storage locations in ZooKeeper.</para> 
+      </section>
+
+      <section>
+        <title>Ephemeral Nodes</title>
+
+        <para>ZooKeeper also has the notion of ephemeral nodes. These znodes
+        exists as long as the session that created the znode is active. When
+        the session ends the znode is deleted. Because of this behavior
+        ephemeral znodes are not allowed to have children.</para>
+      </section>
+
+      <section>
+        <title>Sequence Nodes -- Unique Naming</title>
+
+        <para>When creating a znode you can also request that
+        ZooKeeper append a monotonically increasing counter to the end
+        of path. This counter is unique to the parent znode. The
+        counter has a format of %010d -- that is 10 digits with 0
+        (zero) padding (the counter is formatted in this way to
+        simplify sorting), i.e. "&lt;path&gt;0000000001". See
+        <ulink url="recipes.html#sc_recipes_Queues">Queue
+        Recipe</ulink> for an example use of this feature. Note: the
+        counter used to store the next sequence number is a signed int
+        (4bytes) maintained by the parent node, the counter will
+        overflow when incremented beyond 2147483647 (resulting in a
+        name "&lt;path&gt;-2147483648").</para>
+      </section>
+
+      <section>
+        <title>Container Nodes</title>
+
+        <para><emphasis role="bold">Added in 3.6.0</emphasis></para>
+
+        <para>ZooKeeper has the notion of container znodes. Container znodes are
+          special purpose znodes useful for recipes such as leader, lock, etc.
+          When the last child of a container is deleted, the container becomes
+          a candidate to be deleted by the server at some point in the future.</para>
+
+        <para>Given this property, you should be prepared to get
+          KeeperException.NoNodeException when creating children inside of
+          container znodes. i.e. when creating child znodes inside of container znodes
+          always check for KeeperException.NoNodeException and recreate the container
+          znode when it occurs.</para>
+      </section>
+
+      <section>
+        <title>TTL Nodes</title>
+
+        <para><emphasis role="bold">Added in 3.6.0</emphasis></para>
+
+        <para>When creating PERSISTENT or PERSISTENT_SEQUENTIAL znodes,
+          you can optionally set a TTL in milliseconds for the znode. If the znode
+          is not modified within the TTL and has no children it will become a candidate
+          to be deleted by the server at some point in the future.</para>
+
+        <para>Note: TTL Nodes must be enabled via System property as
+        they are disabled by default. See the <ulink url="zookeeperAdmin.html#sc_configuration">Administrator's
+        Guide</ulink> for details. If you attempt to create TTL Nodes without the proper System property set the server
+        will throw <emphasis>KeeperException.UnimplementedException</emphasis>.</para>
+      </section>
+    </section>
+
+    <section id="sc_timeInZk">
+      <title>Time in ZooKeeper</title>
+
+      <para>ZooKeeper tracks time multiple ways:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">Zxid</emphasis></para>
+
+          <para>Every change to the ZooKeeper state receives a stamp in the
+          form of a <emphasis>zxid</emphasis> (ZooKeeper Transaction Id).
+          This exposes the total ordering of all changes to ZooKeeper. Each
+          change will have a unique zxid and if zxid1 is smaller than zxid2
+          then zxid1 happened before zxid2.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">Version numbers</emphasis></para>
+
+          <para>Every change to a node will cause an increase to one of the
+          version numbers of that node. The three version numbers are version
+          (number of changes to the data of a znode), cversion (number of
+          changes to the children of a znode), and aversion (number of changes
+          to the ACL of a znode).</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">Ticks</emphasis></para>
+
+          <para>When using multi-server ZooKeeper, servers use ticks to define
+          timing of events such as status uploads, session timeouts,
+          connection timeouts between peers, etc. The tick time is only
+          indirectly exposed through the minimum session timeout (2 times the
+          tick time); if a client requests a session timeout less than the
+          minimum session timeout, the server will tell the client that the
+          session timeout is actually the minimum session timeout.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">Real time</emphasis></para>
+
+          <para>ZooKeeper doesn't use real time, or clock time, at all except
+          to put timestamps into the stat structure on znode creation and
+          znode modification.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+
+    <section id="sc_zkStatStructure">
+      <title>ZooKeeper Stat Structure</title>
+
+      <para>The Stat structure for each znode in ZooKeeper is made up of the
+      following fields:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">czxid</emphasis></para>
+
+          <para>The zxid of the change that caused this znode to be
+          created.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">mzxid</emphasis></para>
+
+          <para>The zxid of the change that last modified this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">pzxid</emphasis></para>
+
+          <para>The zxid of the change that last modified children of this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">ctime</emphasis></para>
+
+          <para>The time in milliseconds from epoch when this znode was
+          created.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">mtime</emphasis></para>
+
+          <para>The time in milliseconds from epoch when this znode was last
+          modified.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">version</emphasis></para>
+
+          <para>The number of changes to the data of this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">cversion</emphasis></para>
+
+          <para>The number of changes to the children of this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">aversion</emphasis></para>
+
+          <para>The number of changes to the ACL of this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">ephemeralOwner</emphasis></para>
+
+          <para>The session id of the owner of this znode if the znode is an
+          ephemeral node. If it is not an ephemeral node, it will be
+          zero.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">dataLength</emphasis></para>
+
+          <para>The length of the data field of this znode.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">numChildren</emphasis></para>
+
+          <para>The number of children of this znode.</para>
+        </listitem>
+
+      </itemizedlist>
+    </section>
+  </section>
+
+  <section id="ch_zkSessions">
+    <title>ZooKeeper Sessions</title>
+
+    <para>A ZooKeeper client establishes a session with the ZooKeeper
+    service by creating a handle to the service using a language
+    binding. Once created, the handle starts of in the CONNECTING state
+    and the client library tries to connect to one of the servers that
+    make up the ZooKeeper service at which point it switches to the
+    CONNECTED state. During normal operation will be in one of these
+    two states. If an unrecoverable error occurs, such as session
+    expiration or authentication failure, or if the application explicitly
+    closes the handle, the handle will move to the CLOSED state.
+    The following figure shows the possible state transitions of a
+    ZooKeeper client:</para>
+    
+    <mediaobject id="fg_states" >
+  		<imageobject>
+    		<imagedata fileref="images/state_dia.jpg"/>
+  		</imageobject>
+	</mediaobject>
+    
+    <para>To create a client session the application code must provide
+    a connection string containing a comma separated list of host:port pairs,
+    each corresponding to a ZooKeeper server (e.g. "127.0.0.1:4545" or
+    "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"). The ZooKeeper
+    client library will pick an arbitrary server and try to connect to
+    it. If this connection fails, or if the client becomes
+    disconnected from the server for any reason, the client will
+    automatically try the next server in the list, until a connection
+    is (re-)established.</para>
+
+    <para> <emphasis role="bold">Added in 3.2.0</emphasis>: An
+    optional "chroot" suffix may also be appended to the connection
+    string. This will run the client commands while interpreting all
+    paths relative to this root (similar to the unix chroot
+    command). If used the example would look like:
+    "127.0.0.1:4545/app/a" or
+    "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a" where the
+    client would be rooted at "/app/a" and all paths would be relative
+    to this root - ie getting/setting/etc...  "/foo/bar" would result
+    in operations being run on "/app/a/foo/bar" (from the server
+    perspective). This feature is particularly useful in multi-tenant
+    environments where each user of a particular ZooKeeper service
+    could be rooted differently. This makes re-use much simpler as
+    each user can code his/her application as if it were rooted at
+    "/", while actual location (say /app/a) could be determined at
+    deployment time.</para>
+
+    <para>When a client gets a handle to the ZooKeeper service,
+    ZooKeeper creates a ZooKeeper session, represented as a 64-bit
+    number, that it assigns to the client. If the client connects to a
+    different ZooKeeper server, it will send the session id as a part
+    of the connection handshake.  As a security measure, the server
+    creates a password for the session id that any ZooKeeper server
+    can validate.The password is sent to the client with the session
+    id when the client establishes the session. The client sends this
+    password with the session id whenever it reestablishes the session
+    with a new server.</para>
+
+    <para>One of the parameters to the ZooKeeper client library call
+    to create a ZooKeeper session is the session timeout in
+    milliseconds. The client sends a requested timeout, the server
+    responds with the timeout that it can give the client. The current
+    implementation requires that the timeout be a minimum of 2 times
+    the tickTime (as set in the server configuration) and a maximum of
+    20 times the tickTime. The ZooKeeper client API allows access to
+    the negotiated timeout.</para>
+
+    <para>When a client (session) becomes partitioned from the ZK
+    serving cluster it will begin searching the list of servers that
+    were specified during session creation. Eventually, when
+    connectivity between the client and at least one of the servers is
+    re-established, the session will either again transition to the
+    "connected" state (if reconnected within the session timeout
+    value) or it will transition to the "expired" state (if
+    reconnected after the session timeout). It is not advisable to
+    create a new session object (a new ZooKeeper.class or zookeeper
+    handle in the c binding) for disconnection. The ZK client library
+    will handle reconnect for you. In particular we have heuristics
+    built into the client library to handle things like "herd effect",
+    etc... Only create a new session when you are notified of session
+    expiration (mandatory).</para>
+
+    <para>Session expiration is managed by the ZooKeeper cluster
+    itself, not by the client. When the ZK client establishes a
+    session with the cluster it provides a "timeout" value detailed
+    above. This value is used by the cluster to determine when the
+    client's session expires. Expirations happens when the cluster
+    does not hear from the client within the specified session timeout
+    period (i.e. no heartbeat). At session expiration the cluster will
+    delete any/all ephemeral nodes owned by that session and
+    immediately notify any/all connected clients of the change (anyone
+    watching those znodes). At this point the client of the expired
+    session is still disconnected from the cluster, it will not be
+    notified of the session expiration until/unless it is able to
+    re-establish a connection to the cluster. The client will stay in
+    disconnected state until the TCP connection is re-established with
+    the cluster, at which point the watcher of the expired session
+    will receive the "session expired" notification.</para>
+
+    <para>Example state transitions for an expired session as seen by
+    the expired session's watcher:</para>
+
+    <orderedlist>
+      <listitem><para>'connected' : session is established and client
+      is communicating with cluster (client/server communication is
+      operating properly)</para></listitem>
+      <listitem><para>.... client is partitioned from the
+      cluster</para></listitem>
+      <listitem><para>'disconnected' : client has lost connectivity
+      with the cluster</para></listitem>
+      <listitem><para>.... time elapses, after 'timeout' period the
+      cluster expires the session, nothing is seen by client as it is
+      disconnected from cluster</para></listitem>
+      <listitem><para>.... time elapses, the client regains network
+      level connectivity with the cluster</para></listitem>
+      <listitem><para>'expired' : eventually the client reconnects to
+      the cluster, it is then notified of the
+      expiration</para></listitem>
+    </orderedlist>
+
+    <para>Another parameter to the ZooKeeper session establishment
+    call is the default watcher. Watchers are notified when any state
+    change occurs in the client. For example if the client loses
+    connectivity to the server the client will be notified, or if the
+    client's session expires, etc... This watcher should consider the
+    initial state to be disconnected (i.e. before any state changes
+    events are sent to the watcher by the client lib). In the case of
+    a new connection, the first event sent to the watcher is typically
+    the session connection event.</para>
+
+    <para>The session is kept alive by requests sent by the client. If
+    the session is idle for a period of time that would timeout the
+    session, the client will send a PING request to keep the session
+    alive. This PING request not only allows the ZooKeeper server to
+    know that the client is still active, but it also allows the
+    client to verify that its connection to the ZooKeeper server is
+    still active. The timing of the PING is conservative enough to
+    ensure reasonable time to detect a dead connection and reconnect
+    to a new server.</para>
+
+    <para>
+      Once a connection to the server is successfully established
+      (connected) there are basically two cases where the client lib generates
+      connectionloss (the result code in c binding, exception in Java -- see 
+      the API documentation for binding specific details) when either a synchronous or
+      asynchronous operation is performed and one of the following holds:
+    </para>
+
+    <orderedlist>
+      <listitem><para>The application calls an operation on a session that is no
+      longer alive/valid</para></listitem>
+      <listitem><para>The ZooKeeper client disconnects from a server when there
+      are pending operations to that server, i.e., there is a pending asynchronous call.
+      </para></listitem>
+    </orderedlist>
+
+    <para> <emphasis role="bold">Added in 3.2.0 -- SessionMovedException</emphasis>. There is an internal
+      exception that is generally not seen by clients called the SessionMovedException.
+      This exception occurs because a request was received on a connection for a session
+      which has been reestablished on a different server. The normal cause of this error is
+      a client that sends a request to a server, but the network packet gets delayed, so
+      the client times out and connects to a new server. When the delayed packet arrives at
+      the first server, the old server detects that the session has moved, and closes the
+      client connection. Clients normally do not see this error since they do not read
+      from those old connections. (Old connections are usually closed.) One situation in which this
+      condition can be seen is when two clients try to reestablish the same connection using
+      a saved session id and password. One of the clients will reestablish the connection
+      and the second client will be disconnected (causing the pair to attempt to re-establish
+      its connection/session indefinitely).</para>
+
+    <para> <emphasis role="bold">Updating the list of servers</emphasis>.  We allow a client to 
+      update the connection string by providing a new comma separated list of host:port pairs, 
+      each corresponding to a ZooKeeper server. The function invokes a probabilistic load-balancing 
+      algorithm which may cause the client to disconnect from its current host with the goal
+      to achieve expected uniform number of connections per server in the new list. 
+      In case the current host to which the client is connected is not in the new list
+      this call will always cause the connection to be dropped. Otherwise, the decision
+	  is based on whether the number of servers has increased or decreased and by how much.	
+	</para>
+
+    <para>
+      For example, if the previous connection string contained 3 hosts and now the list contains
+      these 3 hosts and 2 more hosts, 40% of clients connected to each of the 3 hosts will
+      move to one of the new hosts in order to balance the load. The algorithm will cause the client 
+      to drop its connection to the current host to which it is connected with probability 0.4 and in this 
+	  case cause the client to connect to one of the 2 new hosts, chosen at random.
+    </para>
+
+	<para>
+	  Another example -- suppose we have 5 hosts and now update the list to remove 2 of the hosts, 
+	  the clients connected to the 3 remaining hosts will stay connected, whereas all clients connected 
+	  to the 2 removed hosts will need to move to one of the 3 hosts, chosen at random. If the connection
+	  is dropped, the client moves to a special mode where he chooses a new server to connect to using the
+	  probabilistic algorithm, and not just round robin. 
+    </para>
+
+    <para>
+	  In the first example, each client decides to disconnect with probability 0.4 but once the decision is
+	  made, it will try to connect to a random new server and only if it cannot connect to any of the new 
+	  servers will it try to connect to the old ones. After finding a server, or trying all servers in the 
+	  new list and failing to connect, the client moves back to the normal mode of operation where it picks
+	  an arbitrary server from the connectString and attempt to connect to it. If that fails, is will continue
+	  trying different random servers in round robin. (see above the algorithm used to initially choose a server)
+    </para>
+
+  </section>
+
+  <section id="ch_zkWatches">
+    <title>ZooKeeper Watches</title>
+
+    <para>All of the read operations in ZooKeeper - <emphasis
+    role="bold">getData()</emphasis>, <emphasis
+    role="bold">getChildren()</emphasis>, and <emphasis
+    role="bold">exists()</emphasis> - have the option of setting a watch as a
+    side effect. Here is ZooKeeper's definition of a watch: a watch event is
+    one-time trigger, sent to the client that set the watch, which occurs when
+    the data for which the watch was set changes. There are three key points
+    to consider in this definition of a watch:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">One-time trigger</emphasis></para>
+
+        <para>One watch event will be sent to the client when the data has changed.
+        For example, if a client does a getData("/znode1", true) and later the
+        data for /znode1 is changed or deleted, the client will get a watch
+        event for /znode1. If /znode1 changes again, no watch event will be
+        sent unless the client has done another read that sets a new
+        watch.</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">Sent to the client</emphasis></para>
+
+        <para>This implies that an event is on the way to the client, but may
+        not reach the client before the successful return code to the change
+        operation reaches the client that initiated the change. Watches are
+        sent asynchronously to watchers. ZooKeeper provides an ordering
+        guarantee: a client will never see a change for which it has set a
+        watch until it first sees the watch event. Network delays or other
+        factors may cause different clients to see watches and return codes
+        from updates at different times. The key point is that everything seen
+        by the different clients will have a consistent order.</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">The data for which the watch was
+        set</emphasis></para>
+
+        <para>This refers to the different ways a node can change.  It
+        helps to think of ZooKeeper as maintaining two lists of
+        watches: data watches and child watches.  getData() and
+        exists() set data watches. getChildren() sets child
+        watches. Alternatively, it may help to think of watches being
+        set according to the kind of data returned. getData() and
+        exists() return information about the data of the node,
+        whereas getChildren() returns a list of children.  Thus,
+        setData() will trigger data watches for the znode being set
+        (assuming the set is successful). A successful create() will
+        trigger a data watch for the znode being created and a child
+        watch for the parent znode. A successful delete() will trigger
+        both a data watch and a child watch (since there can be no
+        more children) for a znode being deleted as well as a child
+        watch for the parent znode.</para>
+      </listitem>
+    </itemizedlist>
+
+    <para>Watches are maintained locally at the ZooKeeper server to which the
+    client is connected. This allows watches to be lightweight to set,
+    maintain, and dispatch. When a client connects to a new server, the watch
+    will be triggered for any session events. Watches will not be received
+    while disconnected from a server. When a client reconnects, any previously
+    registered watches will be reregistered and triggered if needed. In
+    general this all occurs transparently. There is one case where a watch
+    may be missed: a watch for the existence of a znode not yet created will
+    be missed if the znode is created and deleted while disconnected.</para>
+
+	<section id="sc_WatchSemantics">
+      <title>Semantics of Watches</title>
+	  
+	  <para> We can set watches with the three calls that read the state of 
+	  ZooKeeper: exists, getData, and getChildren. The following list details
+	  the events that a watch can trigger and the calls that enable them:
+	  </para>
+	  
+	  <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">Created event:</emphasis></para>
+          <para>Enabled with a call to exists.</para>
+        </listitem>
+        
+        <listitem>
+          <para><emphasis role="bold">Deleted event:</emphasis></para>
+          <para>Enabled with a call to exists, getData, and getChildren.</para>
+        </listitem>
+        
+        <listitem>
+          <para><emphasis role="bold">Changed event:</emphasis></para>
+          <para>Enabled with a call to exists and getData.</para>
+        </listitem>
+        
+        <listitem>
+          <para><emphasis role="bold">Child event:</emphasis></para>
+          <para>Enabled with a call to getChildren.</para>
+        </listitem>
+      </itemizedlist>
+	</section>
+
+    <section id="sc_WatchRemoval">
+      <title>Remove Watches</title>
+      <para>We can remove the watches registered on a znode with a call to 
+      removeWatches. Also, a ZooKeeper client can remove watches locally even
+      if there is no server connection by setting the local flag to true. The 
+      following list details the events which will be triggered after the 
+      successful watch removal.
+      </para>
+      <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">Child Remove event:</emphasis></para>
+          <para>Watcher which was added with a call to getChildren.</para>
+        </listitem>
+        
+        <listitem>
+          <para><emphasis role="bold">Data Remove event:</emphasis></para>
+          <para>Watcher which was added with a call to exists or getData.</para>
+        </listitem>
+      </itemizedlist>
+   </section>
+
+    <section id="sc_WatchGuarantees">
+      <title>What ZooKeeper Guarantees about Watches</title>
+
+      <para>With regard to watches, ZooKeeper maintains these
+      guarantees:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>Watches are ordered with respect to other events, other
+          watches, and asynchronous replies. The ZooKeeper client libraries
+          ensures that everything is dispatched in order.</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>A client will see a watch event for a znode it is watching
+          before seeing the new data that corresponds to that znode.</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>The order of watch events from ZooKeeper corresponds to the
+          order of the updates as seen by the ZooKeeper service.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+
+    <section id="sc_WatchRememberThese">
+      <title>Things to Remember about Watches</title>
+
+      <itemizedlist>
+        <listitem>
+          <para>Watches are one time triggers; if you get a watch event and
+          you want to get notified of future changes, you must set another
+          watch.</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>Because watches are one time triggers and there is latency
+          between getting the event and sending a new request to get a watch
+          you cannot reliably see every change that happens to a node in
+          ZooKeeper. Be prepared to handle the case where the znode changes
+          multiple times between getting the event and setting the watch
+          again. (You may not care, but at least realize it may
+          happen.)</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>A watch object, or function/context pair, will only be
+          triggered once for a given notification. For example, if the same
+          watch object is registered for an exists and a getData call for the
+          same file and that file is then deleted, the watch object would
+          only be invoked once with the deletion notification for the file.
+          </para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>When you disconnect from a server (for example, when the
+          server fails), you will not get any watches until the connection
+          is reestablished. For this reason session events are sent to all
+          outstanding watch handlers. Use session events to go into a safe
+          mode: you will not be receiving events while disconnected, so your
+          process should act conservatively in that mode.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+  </section>
+
+  <section id="sc_ZooKeeperAccessControl">
+    <title>ZooKeeper access control using ACLs</title>
+
+    <para>ZooKeeper uses ACLs to control access to its znodes (the
+    data nodes of a ZooKeeper data tree). The ACL implementation is
+    quite similar to UNIX file access permissions: it employs
+    permission bits to allow/disallow various operations against a
+    node and the scope to which the bits apply. Unlike standard UNIX
+    permissions, a ZooKeeper node is not limited by the three standard
+    scopes for user (owner of the file), group, and world
+    (other). ZooKeeper does not have a notion of an owner of a
+    znode. Instead, an ACL specifies sets of ids and permissions that
+    are associated with those ids.</para>
+
+    <para>Note also that an ACL pertains only to a specific znode. In
+    particular it does not apply to children. For example, if
+    <emphasis>/app</emphasis> is only readable by ip:172.16.16.1 and
+    <emphasis>/app/status</emphasis> is world readable, anyone will
+    be able to read <emphasis>/app/status</emphasis>; ACLs are not
+    recursive.</para>
+
+    <para>ZooKeeper supports pluggable authentication schemes. Ids are
+    specified using the form <emphasis>scheme:expression</emphasis>,
+    where <emphasis>scheme</emphasis> is the authentication scheme
+    that the id corresponds to. The set of valid expressions are defined
+    by the scheme. For example, <emphasis>ip:172.16.16.1</emphasis> is
+    an id for a host with the address <emphasis>172.16.16.1</emphasis>
+    using the <emphasis>ip</emphasis> scheme, whereas <emphasis>digest:bob:password</emphasis>
+    is an id for the user with the name of <emphasis>bob</emphasis> using
+    the <emphasis>digest</emphasis> scheme.</para>
+
+    <para>When a client connects to ZooKeeper and authenticates
+    itself, ZooKeeper associates all the ids that correspond to a
+    client with the clients connection. These ids are checked against
+    the ACLs of znodes when a clients tries to access a node. ACLs are
+    made up of pairs of <emphasis>(scheme:expression,
+    perms)</emphasis>. The format of
+    the <emphasis>expression</emphasis> is specific to the scheme. For
+    example, the pair <emphasis>(ip:19.22.0.0/16, READ)</emphasis>
+    gives the <emphasis>READ</emphasis> permission to any clients with
+    an IP address that starts with 19.22.</para>
+
+    <section id="sc_ACLPermissions">
+      <title>ACL Permissions</title>
+                               
+      <para>ZooKeeper supports the following permissions:</para>
+
+      <itemizedlist>
+        <listitem><para><emphasis role="bold">CREATE</emphasis>: you can create a child node</para></listitem>
+        <listitem><para><emphasis role="bold">READ</emphasis>: you can get data from a node and list its children.</para></listitem>
+        <listitem><para><emphasis role="bold">WRITE</emphasis>: you can set data for a node</para></listitem>
+        <listitem><para><emphasis role="bold">DELETE</emphasis>: you can delete a child node</para></listitem>
+        <listitem><para><emphasis role="bold">ADMIN</emphasis>: you can set permissions</para></listitem>
+      </itemizedlist>
+
+      <para>The <emphasis>CREATE</emphasis>
+      and <emphasis>DELETE</emphasis> permissions have been broken out
+      of the <emphasis>WRITE</emphasis> permission for finer grained
+      access controls. The cases for <emphasis>CREATE</emphasis>
+      and <emphasis>DELETE</emphasis> are the following:</para>
+
+      <para>You want A to be able to do a set on a ZooKeeper node, but
+      not be able to <emphasis>CREATE</emphasis>
+      or <emphasis>DELETE</emphasis> children.</para>
+
+      <para><emphasis>CREATE</emphasis>
+      without <emphasis>DELETE</emphasis>: clients create requests by
+      creating ZooKeeper nodes in a parent directory. You want all
+      clients to be able to add, but only request processor can
+      delete. (This is kind of like the APPEND permission for
+      files.)</para>
+
+      <para>Also, the <emphasis>ADMIN</emphasis> permission is there
+      since ZooKeeper doesn’t have a notion of file owner. In some
+      sense the <emphasis>ADMIN</emphasis> permission designates the
+      entity as the owner. ZooKeeper doesn’t support the LOOKUP
+      permission (execute permission bit on directories to allow you
+      to LOOKUP even though you can't list the directory). Everyone
+      implicitly has LOOKUP permission. This allows you to stat a
+      node, but nothing more. (The problem is, if you want to call
+      zoo_exists() on a node that doesn't exist, there is no
+      permission to check.)</para>
+
+    <section id="sc_BuiltinACLSchemes">
+      <title>Builtin ACL Schemes</title>
+
+      <para>ZooKeeeper has the following built in schemes:</para>
+
+      <itemizedlist>
+        <listitem><para><emphasis role="bold">world</emphasis> has a
+        single id, <emphasis>anyone</emphasis>, that represents
+        anyone.</para></listitem>
+
+        <listitem><para><emphasis role="bold">auth</emphasis> is a special
+        scheme which ignores any provided expression and instead uses the current user,
+        credentials, and scheme. Any expression (whether <emphasis>user</emphasis> like with SASL
+        authentication or <emphasis>user:password</emphasis> like with DIGEST authentication) provided is ignored
+        by the ZooKeeper server when persisting the ACL. However, the expression must still be
+        provided in the ACL because the ACL must match the form <emphasis>scheme:expression:perms</emphasis>.
+        This scheme is provided as a convenience as it is a common use-case for
+        a user to create a znode and then restrict access to that znode to only that user.
+        If there is no authenticated user, setting an ACL with the auth scheme will fail.
+        </para></listitem>
+
+        <listitem><para><emphasis role="bold">digest</emphasis> uses
+        a <emphasis>username:password</emphasis> string to generate
+        MD5 hash which is then used as an ACL ID
+        identity. Authentication is done by sending
+        the <emphasis>username:password</emphasis> in clear text. When
+        used in the ACL the expression will be
+        the <emphasis>username:base64</emphasis>
+        encoded <emphasis>SHA1</emphasis>
+        password <emphasis>digest</emphasis>.</para>
+        </listitem>
+
+        <listitem><para><emphasis role="bold">ip</emphasis> uses the
+        client host IP as an ACL ID identity. The ACL expression is of
+        the form <emphasis>addr/bits</emphasis> where the most
+        significant <emphasis>bits</emphasis>
+        of <emphasis>addr</emphasis> are matched against the most
+        significant <emphasis>bits</emphasis> of the client host
+        IP.</para></listitem>
+
+        <listitem><para><emphasis role="bold">x509</emphasis> uses the client
+        X500 Principal as an ACL ID identity. The ACL expression is the exact
+        X500 Principal name of a client. When using the secure port, clients
+        are automatically authenticated and their auth info for the x509 scheme
+        is set.</para></listitem>
+
+      </itemizedlist>
+    </section>
+
+    <section>
+      <title>ZooKeeper C client API</title>
+
+      <para>The following constants are provided by the ZooKeeper C
+      library:</para>
+
+      <itemizedlist>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_READ; //can read node’s value and list its children</para></listitem>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_WRITE;// can set the node’s value</para></listitem>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_CREATE; //can create children</para></listitem>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_DELETE;// can delete children</para></listitem>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_ADMIN; //can execute set_acl()</para></listitem>
+        <listitem><para><emphasis>const</emphasis> <emphasis>int</emphasis> ZOO_PERM_ALL;// all of the above flags OR’d together</para></listitem>
+      </itemizedlist>
+
+      <para>The following are the standard ACL IDs:</para>
+
+      <itemizedlist>
+        <listitem><para><emphasis>struct</emphasis> Id ZOO_ANYONE_ID_UNSAFE; //(‘world’,’anyone’)</para></listitem>
+        <listitem><para><emphasis>struct</emphasis> Id ZOO_AUTH_IDS;// (‘auth’,’’)</para></listitem>
+      </itemizedlist>
+
+      <para>ZOO_AUTH_IDS empty identity string should be interpreted as “the identity of the creator”.</para>
+
+      <para>ZooKeeper client comes with three standard ACLs:</para>
+
+      <itemizedlist>
+        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_OPEN_ACL_UNSAFE; //(ZOO_PERM_ALL,ZOO_ANYONE_ID_UNSAFE)</para></listitem>
+        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_READ_ACL_UNSAFE;// (ZOO_PERM_READ, ZOO_ANYONE_ID_UNSAFE)</para></listitem>
+        <listitem><para><emphasis>struct</emphasis> ACL_vector ZOO_CREATOR_ALL_ACL; //(ZOO_PERM_ALL,ZOO_AUTH_IDS)</para></listitem>
+      </itemizedlist>
+
+      <para>The ZOO_OPEN_ACL_UNSAFE is completely open free for all
+      ACL: any application can execute any operation on the node and
+      can create, list and delete its children. The
+      ZOO_READ_ACL_UNSAFE is read-only access for any
+      application. CREATE_ALL_ACL grants all permissions to the
+      creator of the node. The creator must have been authenticated by
+      the server (for example, using “<emphasis>digest</emphasis>”
+      scheme) before it can create nodes with this ACL.</para>
+
+      <para>The following ZooKeeper operations deal with ACLs:</para>
+
+      <itemizedlist><listitem>
+          <para><emphasis>int</emphasis> <emphasis>zoo_add_auth</emphasis>
+            (zhandle_t *zh,<emphasis>const</emphasis> <emphasis>char</emphasis>*
+            scheme,<emphasis>const</emphasis> <emphasis>char</emphasis>*
+            cert, <emphasis>int</emphasis> certLen, void_completion_t
+            completion, <emphasis>const</emphasis> <emphasis>void</emphasis>
+            *data);</para>
+      </listitem></itemizedlist>
+
+      <para>The application uses the zoo_add_auth function to
+      authenticate itself to the server. The function can be called
+      multiple times if the application wants to authenticate using
+      different schemes and/or identities.</para>
+
+      <itemizedlist><listitem>
+          <para><emphasis>int</emphasis> <emphasis>zoo_create</emphasis>
+            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
+            *path, <emphasis>const</emphasis> <emphasis>char</emphasis>
+            *value,<emphasis>int</emphasis>
+            valuelen, <emphasis>const</emphasis> <emphasis>struct</emphasis>
+            ACL_vector *acl, <emphasis>int</emphasis>
+            flags,<emphasis>char</emphasis>
+            *realpath, <emphasis>int</emphasis>
+            max_realpath_len);</para>
+      </listitem></itemizedlist>
+
+      <para>zoo_create(...) operation creates a new node. The acl
+      parameter is a list of ACLs associated with the node. The parent
+      node must have the CREATE permission bit set.</para>
+
+      <itemizedlist><listitem>
+          <para><emphasis>int</emphasis> <emphasis>zoo_get_acl</emphasis>
+            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
+            *path,<emphasis>struct</emphasis> ACL_vector
+            *acl, <emphasis>struct</emphasis> Stat *stat);</para>
+      </listitem></itemizedlist>
+
+      <para>This operation returns a node’s ACL info.</para>
+
+      <itemizedlist><listitem>
+          <para><emphasis>int</emphasis> <emphasis>zoo_set_acl</emphasis>
+            (zhandle_t *zh, <emphasis>const</emphasis> <emphasis>char</emphasis>
+            *path, <emphasis>int</emphasis>
+            version,<emphasis>const</emphasis> <emphasis>struct</emphasis>
+            ACL_vector *acl);</para>
+      </listitem></itemizedlist>
+
+      <para>This function replaces node’s ACL list with a new one. The
+      node must have the ADMIN permission set.</para>
+
+      <para>Here is a sample code that makes use of the above APIs to
+      authenticate itself using the “<emphasis>foo</emphasis>” scheme
+      and create an ephemeral node “/xyz” with create-only
+      permissions.</para>
+
+      <note><para>This is a very simple example which is intended to show
+        how to interact with ZooKeeper ACLs
+        specifically. See <filename>.../trunk/src/c/src/cli.c</filename>
+        for an example of a C client implementation</para>
+      </note>
+
+      <programlisting>
+#include &lt;string.h>
+#include &lt;errno.h>
+
+#include "zookeeper.h"
+
+static zhandle_t *zh;
+
+/**
+ * In this example this method gets the cert for your
+ *   environment -- you must provide
+ */
+char *foo_get_cert_once(char* id) { return 0; }
+
+/** Watcher function -- empty for this example, not something you should
+ * do in real code */
+void watcher(zhandle_t *zzh, int type, int state, const char *path,
+             void *watcherCtx) {}
+
+int main(int argc, char argv) {
+  char buffer[512];
+  char p[2048];
+  char *cert=0;
+  char appId[64];
+
+  strcpy(appId, "example.foo_test");
+  cert = foo_get_cert_once(appId);
+  if(cert!=0) {
+    fprintf(stderr,
+            "Certificate for appid [%s] is [%s]\n",appId,cert);
+    strncpy(p,cert, sizeof(p)-1);
+    free(cert);
+  } else {
+    fprintf(stderr, "Certificate for appid [%s] not found\n",appId);
+    strcpy(p, "dummy");
+  }
+
+  zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
+
+  zh = zookeeper_init("localhost:3181", watcher, 10000, 0, 0, 0);
+  if (!zh) {
+    return errno;
+  }
+  if(zoo_add_auth(zh,"foo",p,strlen(p),0,0)!=ZOK)
+    return 2;
+
+  struct ACL CREATE_ONLY_ACL[] = {{ZOO_PERM_CREATE, ZOO_AUTH_IDS}};
+  struct ACL_vector CREATE_ONLY = {1, CREATE_ONLY_ACL};
+  int rc = zoo_create(zh,"/xyz","value", 5, &amp;CREATE_ONLY, ZOO_EPHEMERAL,
+                      buffer, sizeof(buffer)-1);
+
+  /** this operation will fail with a ZNOAUTH error */
+  int buflen= sizeof(buffer);
+  struct Stat stat;
+  rc = zoo_get(zh, "/xyz", 0, buffer, &amp;buflen, &amp;stat);
+  if (rc) {
+    fprintf(stderr, "Error %d for %s\n", rc, __LINE__);
+  }
+
+  zookeeper_close(zh);
+  return 0;
+}
+      </programlisting>
+    </section>
+    </section>
+  </section>
+
+  <section id="sc_ZooKeeperPluggableAuthentication">
+    <title>Pluggable ZooKeeper authentication</title>
+
+    <para>ZooKeeper runs in a variety of different environments with
+    various different authentication schemes, so it has a completely
+    pluggable authentication framework. Even the builtin authentication
+    schemes use the pluggable authentication framework.</para>
+
+    <para>To understand how the authentication framework works, first you must
+    understand the two main authentication operations. The framework 
+    first must authenticate the client. This is usually done as soon as
+    the client connects to a server and consists of validating information
+    sent from or gathered about a client and associating it with the connection.
+    The second operation handled by the framework is finding the entries in an
+    ACL that correspond to client. ACL entries are &lt;<emphasis>idspec, 
+    permissions</emphasis>&gt; pairs. The <emphasis>idspec</emphasis> may be
+    a simple string match against the authentication information associated
+    with the connection or it may be a expression that is evaluated against that
+    information. It is up to the implementation of the authentication plugin
+    to do the match. Here is the interface that an authentication plugin must
+    implement:</para>
+
+    <programlisting>
+public interface AuthenticationProvider {
+    String getScheme();
+    KeeperException.Code handleAuthentication(ServerCnxn cnxn, byte authData[]);
+    boolean isValid(String id);
+    boolean matches(String id, String aclExpr);
+    boolean isAuthenticated();
+}
+    </programlisting>
+
+    <para>The first method <emphasis>getScheme</emphasis> returns the string
+    that identifies the plugin. Because we support multiple methods of authentication,
+    an authentication credential or an <emphasis>idspec</emphasis> will always be
+    prefixed with <emphasis>scheme:</emphasis>. The ZooKeeper server uses the scheme
+    returned by the authentication plugin to determine which ids the scheme
+    applies to.</para>
+
+    <para><emphasis>handleAuthentication</emphasis> is called when a client
+    sends authentication information to be associated with a connection. The
+    client specifies the scheme to which the information corresponds. The
+    ZooKeeper server passes the information to the authentication plugin whose
+    <emphasis>getScheme</emphasis> matches the scheme passed by the client. The
+    implementor of <emphasis>handleAuthentication</emphasis> will usually return
+    an error if it determines that the information is bad, or it will associate information
+    with the connection using <emphasis>cnxn.getAuthInfo().add(new Id(getScheme(), data))</emphasis>.
+    </para>
+
+    <para>The authentication plugin is involved in both setting and using ACLs. When an
+    ACL is set for a znode, the ZooKeeper server will pass the id part of the entry to
+    the <emphasis>isValid(String id)</emphasis> method. It is up to the plugin to verify
+    that the id has a correct form. For example, <emphasis>ip:172.16.0.0/16</emphasis>
+    is a valid id, but <emphasis>ip:host.com</emphasis> is not. If the new ACL includes
+    an "auth" entry, <emphasis>isAuthenticated</emphasis> is used to see if the 
+    authentication information for this scheme that is assocatied with the connection
+    should be added to the ACL. Some schemes
+    should not be included in auth. For example, the IP address of the client is not
+    considered as an id that should be added to the ACL if auth is specified.</para>
+
+    <para>ZooKeeper invokes
+    <emphasis>matches(String id, String aclExpr)</emphasis> when checking an ACL. It
+    needs to match authentication information of the client against the relevant ACL
+    entries. To find the entries which apply to the client, the ZooKeeper server will
+    find the scheme of each entry and if there is authentication information
+    from that client for that scheme, <emphasis>matches(String id, String aclExpr)</emphasis>
+    will be called with <emphasis>id</emphasis> set to the authentication information
+    that was previously added to the connection by <emphasis>handleAuthentication</emphasis> and
+    <emphasis>aclExpr</emphasis> set to the id of the ACL entry. The authentication plugin
+    uses its own logic and matching scheme to determine if <emphasis>id</emphasis> is included
+    in <emphasis>aclExpr</emphasis>. 
+    </para>
+
+    <para>There are two built in authentication plugins: <emphasis>ip</emphasis> and
+    <emphasis>digest</emphasis>. Additional plugins can adding using system properties. At
+    startup the ZooKeeper server will look for system properties that start with
+    "zookeeper.authProvider." and interpret the value of those properties as the class name
+    of an authentication plugin. These properties can be set using the
+    <emphasis>-Dzookeeeper.authProvider.X=com.f.MyAuth</emphasis> or adding entries such as
+    the following in the server configuration file:</para>
+
+    <programlisting>
+authProvider.1=com.f.MyAuth
+authProvider.2=com.f.MyAuth2
+    </programlisting>
+ 
+    <para>Care should be taking to ensure that the suffix on the property is unique. If there are 
+    duplicates such as <emphasis>-Dzookeeeper.authProvider.X=com.f.MyAuth -Dzookeeper.authProvider.X=com.f.MyAuth2</emphasis>,
+    only one will be used. Also all servers must have the same plugins defined, otherwise clients using
+    the authentication schemes provided by the plugins will have problems connecting to some servers.
+    </para>
+
+    <para> <emphasis role="bold">Added in 3.6.0</emphasis>: An alternate abstraction is available for pluggable
+    authentication. It provides additional arguments.
+    </para>
+
+    <programlisting>
+public abstract class ServerAuthenticationProvider implements AuthenticationProvider {
+    public abstract KeeperException.Code handleAuthentication(ServerObjs serverObjs, byte authData[]);
+    public abstract boolean matches(ServerObjs serverObjs, MatchValues matchValues);
+}
+    </programlisting>
+
+    <para>
+    Instead of implementing AuthenticationProvider you extend ServerAuthenticationProvider. Your handleAuthentication()
+    and matches() methods will then receive the additional parameters (via ServerObjs and MatchValues).
+    </para>
+
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">ZooKeeperServer</emphasis></para>
+
+        <para>The ZooKeeperServer instance</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">ServerCnxn</emphasis></para>
+
+        <para>The current connection</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">path</emphasis></para>
+
+        <para>The ZNode path being operated on (or null if not used)</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">perm</emphasis></para>
+
+        <para>The operation value or 0</para>
+      </listitem>
+
+      <listitem>
+        <para><emphasis role="bold">setAcls</emphasis></para>
+
+        <para>When the setAcl() method is being operated on, the list of ACLs that are being set</para>
+      </listitem>
+    </itemizedlist>
+  </section>
+      
+  <section id="ch_zkGuarantees">
+    <title>Consistency Guarantees</title>
+
+    <para>ZooKeeper is a high performance, scalable service. Both reads and
+    write operations are designed to be fast, though reads are faster than
+    writes. The reason for this is that in the case of reads, ZooKeeper can
+    serve older data, which in turn is due to ZooKeeper's consistency
+    guarantees:</para>
+
+    <variablelist>
+      <varlistentry>
+        <term>Sequential Consistency</term>
+
+        <listitem>
+          <para>Updates from a client will be applied in the order that they
+          were sent.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>Atomicity</term>
+
+        <listitem>
+          <para>Updates either succeed or fail -- there are no partial
+          results.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>Single System Image</term>
+
+        <listitem>
+          <para>A client will see the same view of the service regardless of
+          the server that it connects to.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>Reliability</term>
+
+        <listitem>
+          <para>Once an update has been applied, it will persist from that
+          time forward until a client overwrites the update. This guarantee
+          has two corollaries:</para>
+
+          <orderedlist>
+            <listitem>
+              <para>If a client gets a successful return code, the update will
+              have been applied. On some failures (communication errors,
+              timeouts, etc) the client will not know if the update has
+              applied or not. We take steps to minimize the failures, but the
+              guarantee is only present with successful return codes.
+              (This is called the <emphasis>monotonicity condition</emphasis> in Paxos.)</para>
+            </listitem>
+
+            <listitem>
+              <para>Any updates that are seen by the client, through a read
+              request or successful update, will never be rolled back when
+              recovering from server failures.</para>
+            </listitem>
+          </orderedlist>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term>Timeliness</term>
+
+        <listitem>
+          <para>The clients view of the system is guaranteed to be up-to-date
+          within a certain time bound (on the order of tens of seconds).
+          Either system changes will be seen by a client within this bound, or
+          the client will detect a service outage.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>Using these consistency guarantees it is easy to build higher level
+    functions such as leader election, barriers, queues, and read/write
+    revocable locks solely at the ZooKeeper client (no additions needed to
+    ZooKeeper). See <ulink url="recipes.html">Recipes and Solutions</ulink>
+    for more details.</para>
+
+    <note>
+        <para>Sometimes developers mistakenly assume one other guarantee that
+        ZooKeeper does <emphasis>not</emphasis> in fact make. This is:</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>Simultaneously Consistent Cross-Client Views</term>
+
+            <listitem>
+              <para>ZooKeeper does not guarantee that at every instance in
+              time, two different clients will have identical views of
+              ZooKeeper data. Due to factors like network delays, one client
+              may perform an update before another client gets notified of the
+              change. Consider the scenario of two clients, A and B. If client
+              A sets the value of a znode /a from 0 to 1, then tells client B
+              to read /a, client B may read the old value of 0, depending on
+              which server it is connected to. If it
+              is important that Client A and Client B read the same value,
+              Client B should should call the <emphasis
+              role="bold">sync()</emphasis> method from the ZooKeeper API
+              method before it performs its read.</para>
+
+              <para>So, ZooKeeper by itself doesn't guarantee that changes occur 
+              synchronously across all servers, but ZooKeeper
+              primitives can be used to construct higher level functions that
+              provide useful client synchronization. (For more information,
+              see the <ulink
+              url="recipes.html">ZooKeeper Recipes</ulink>.
+              <emphasis>[tbd:..]</emphasis>).</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </note>
+  </section>
+
+  <section id="ch_bindings">
+    <title>Bindings</title>
+
+    <para>The ZooKeeper client libraries come in two languages: Java and C.
+    The following sections describe these.</para>
+
+    <section>
+      <title>Java Binding</title>
+
+      <para>There are two packages that make up the ZooKeeper Java binding:
+      <emphasis role="bold">org.apache.zookeeper</emphasis> and <emphasis
+      role="bold">org.apache.zookeeper.data</emphasis>. The rest of the
+      packages that make up ZooKeeper are used internally or are part of the
+      server implementation. The <emphasis
+      role="bold">org.apache.zookeeper.data</emphasis> package is made up of
+      generated classes that are used simply as containers.</para>
+
+      <para>The main class used by a ZooKeeper Java client is the <emphasis
+      role="bold">ZooKeeper</emphasis> class. Its two constructors differ only
+      by an optional session id and password. ZooKeeper supports session
+      recovery accross instances of a process. A Java program may save its
+      session id and password to stable storage, restart, and recover the
+      session that was used by the earlier instance of the program.</para>
+
+      <para>When a ZooKeeper object is created, two threads are created as
+      well: an IO thread and an event thread. All IO happens on the IO thread
+      (using Java NIO). All event callbacks happen on the event thread.
+      Session maintenance such as reconnecting to ZooKeeper servers and
+      maintaining heartbeat is done on the IO thread. Responses for
+      synchronous methods are also processed in the IO thread. All responses
+      to asynchronous methods and watch events are processed on the event
+      thread. There are a few things to notice that result from this
+      design:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>All completions for asynchronous calls and watcher callbacks
+          will be made in order, one at a time. The caller can do any
+          processing they wish, but no other callbacks will be processed
+          during that time.</para>
+        </listitem>
+
+        <listitem>
+          <para>Callbacks do not block the processing of the IO thread or the
+          processing of the synchronous calls.</para>
+        </listitem>
+
+        <listitem>
+          <para>Synchronous calls may not return in the correct order. For
+          example, assume a client does the following processing: issues an
+          asynchronous read of node <emphasis role="bold">/a</emphasis> with
+          <emphasis>watch</emphasis> set to true, and then in the completion
+          callback of the read it does a synchronous read of <emphasis
+          role="bold">/a</emphasis>. (Maybe not good practice, but not illegal
+          either, and it makes for a simple example.)</para>
+
+          <para>Note that if there is a change to <emphasis
+          role="bold">/a</emphasis> between the asynchronous read and the
+          synchronous read, the client library will receive the watch event
+          saying <emphasis role="bold">/a</emphasis> changed before the
+          response for the synchronous read, but because the completion
+          callback is blocking the event queue, the synchronous read will
+          return with the new value of <emphasis role="bold">/a</emphasis>
+          before the watch event is processed.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>Finally, the rules associated with shutdown are straightforward:
+      once a ZooKeeper object is closed or receives a fatal event
+      (SESSION_EXPIRED and AUTH_FAILED), the ZooKeeper object becomes invalid.
+      On a close, the two threads shut down and any further access on zookeeper
+      handle is undefined behavior and should be avoided. </para>
+      <section id="sc_java_client_configuration">
+        <title><emphasis role="bold">Client Configuration Parameters</emphasis></title>
+        <para>
+            The following list contains configuration properties for the Java client. You can set any
+            of these properties using Java system properties. For server properties, please check the
+            following reference
+            <ulink url="zookeeperAdmin.html#sc_configuration">Server configuration section.</ulink>
+        </para>
+        <variablelist>
+            <varlistentry>
+                <term>zookeeper.sasl.client</term>
+                <listitem>
+                    <para>Set the value to <emphasis role="bold">false</emphasis> to disable
+                    SASL authentication. Default is <emphasis role="bold">true</emphasis>.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.sasl.clientconfig</term>
+                <listitem>
+                    <para>Specifies the context key in the JAAS login file. Default is "Client".</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.sasl.client.username</term>
+                <listitem>
+                    <para>Traditionally, a principal is divided into three parts: the primary, the instance, and the realm.
+                        The format of a typical Kerberos V5 principal is primary/instance@REALM.
+                        zookeeper.sasl.client.username specifies the primary part of the server principal. Default
+                        is "zookeeper". Instance part is derived from the server IP. Finally server's principal is
+                        username/IP@realm, where username is the value of zookeeper.sasl.client.username, IP is
+                        the server IP, and realm is the value of zookeeper.server.realm.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.server.realm</term>
+                <listitem>
+                    <para>Realm part of the server principal. By default it is the client principal realm.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.disableAutoWatchReset</term>
+                <listitem>
+                    <para>This switch controls whether automatic watch resetting is enabled. Clients automatically
+                        reset watches during session reconnect by default, this option allows the client to turn off
+                        this behavior by setting zookeeper.disableAutoWatchReset to <emphasis role="bold">true</emphasis>. 
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.client.secure</term>
+                <listitem>
+                    <para>
+                        If you want to connect to the server secure client port, you need to set this property to
+                        <emphasis role="bold">true</emphasis>
+                        on the client. This will connect to server using SSL with specified credentials. Note that
+                        it requires the Netty client.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.clientCnxnSocket</term>
+                <listitem>
+                    <para>
+                        Specifies which ClientCnxnSocket to be used. Possible values are
+                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNIO</emphasis>
+                        and
+                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>
+                        . Default is
+                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNIO</emphasis>
+                        . If you want to connect to server's secure client port, you need to set this property to
+                        <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>
+                        on client.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.ssl.keyStore.location and zookeeper.ssl.keyStore.password</term>
+                <listitem>
+                    <para>Specifies the file path to a JKS containing the local credentials to be used for SSL connections,
+                        and the password to unlock the file.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.ssl.trustStore.location and zookeeper.ssl.trustStore.password</term>
+                <listitem>
+                    <para>Specifies the file path to a JKS containing the remote credentials to be used for SSL connections,
+                        and the password to unlock the file.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>jute.maxbuffer</term>
+                <listitem>
+                    <para>It specifies the maximum size of the incoming data from the server. The default value is 4194304
+                        Bytes , or just 4 MB. This is really a sanity check. The ZooKeeper server is designed to store and send
+                        data on the order of kilobytes. If incoming data length is more than this value, an IOException
+                        is raised.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>zookeeper.kinit</term>
+                <listitem>
+                    <para>Specifies path to kinit binary. Default is "/usr/bin/kinit".</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </section>
+    </section>
+
+    <section>
+      <title>C Binding</title>
+
+      <para>The C binding has a single-threaded and multi-threaded library.
+      The multi-threaded library is easiest to use and is most similar to the
+      Java API. This library will create an IO thread and an event dispatch
+      thread for handling connection maintenance and callbacks. The
+      single-threaded library allows ZooKeeper to be used in event driven
+      applications by exposing the event loop used in the multi-threaded
+      library.</para>
+
+      <para>The package includes two shared libraries: zookeeper_st and
+      zookeeper_mt. The former only provides the asynchronous APIs and
+      callbacks for integrating into the application's event loop. The only
+      reason this library exists is to support the platforms were a
+      <emphasis>pthread</emphasis> library is not available or is unstable
+      (i.e. FreeBSD 4.x). In all other cases, application developers should
+      link with zookeeper_mt, as it includes support for both Sync and Async
+      API.</para>
+
+      <section>
+        <title>Installation</title>
+
+        <para>If you're building the client from a check-out from the Apache
+        repository, follow the steps outlined below. If you're building from a
+        project source package downloaded from apache, skip to step <emphasis
+        role="bold">3</emphasis>.</para>
+
+        <orderedlist>
+          <listitem>
+            <para>Run <command>ant compile_jute</command> from the ZooKeeper
+            top level directory (<filename>.../trunk</filename>).
+            This will create a directory named "generated" under
+            <filename>.../trunk/src/c</filename>.</para>
+          </listitem>
+
+          <listitem>
+            <para>Change directory to the<filename>.../trunk/src/c</filename>
+            and run <command>autoreconf -if</command> to bootstrap <emphasis
+            role="bold">autoconf</emphasis>, <emphasis
+            role="bold">automake</emphasis> and <emphasis
+            role="bold">libtool</emphasis>. Make sure you have <emphasis
+            role="bold">autoconf version 2.59</emphasis> or greater installed.
+            Skip to step<emphasis role="bold"> 4</emphasis>.</para>
+          </listitem>
+
+          <listitem>
+            <para>If you are building from a project source package,
+            unzip/untar the source tarball and cd to the<filename>
+            zookeeper-x.x.x/src/c</filename> directory.</para>
+          </listitem>
+
+          <listitem>
+            <para>Run <command>./configure &lt;your-options&gt;</command> to
+            generate the makefile. Here are some of options the <emphasis
+            role="bold">configure</emphasis> utility supports that can be
+            useful in this step:</para>
+
+            <itemizedlist>
+              <listitem>
+                <para><command>--enable-debug</command></para>
+
+                <para>Enables optimization and enables debug info compiler
+                options. (Disabled by default.)</para>
+              </listitem>
+
+              <listitem>
+                <para><command>--without-syncapi </command></para>
+
+                <para>Disables Sync API support; zookeeper_mt library won't be
+                built. (Enabled by default.)</para>
+              </listitem>
+
+              <listitem>
+                <para><command>--disable-static </command></para>
+
+                <para>Do not build static libraries. (Enabled by
+                default.)</para>
+              </listitem>
+
+              <listitem>
+                <para><command>--disable-shared</command></para>
+
+                <para>Do not build shared libraries. (Enabled by
+                default.)</para>
+              </listitem>
+            </itemizedlist>
+
+            <note>
+              <para>See INSTALL for general information about running
+              <emphasis role="bold">configure</emphasis>.</para>
+            </note>
+          </listitem>
+
+          <listitem>
+            <para>Run <command>make</command> or <command>make
+            install</command> to build the libraries and install them.</para>
+          </listitem>
+
+          <listitem>
+            <para>To generate doxygen documentation for the ZooKeeper API, run
+            <command>make doxygen-doc</command>. All documentation will be
+            placed in a new subfolder named docs. By default, this command
+            only generates HTML. For information on other document formats,
+            run <command>./configure --help</command></para>
+          </listitem>
+        </orderedlist>
+      </section>
+
+      <section>
+        <title>Building Your Own C Client</title>
+
+        <para>In order to be able to use the ZooKeeper C API in your application
+        you have to remember to</para>
+
+        <orderedlist>
+          <listitem>
+            <para>Include ZooKeeper header: #include
+              &lt;zookeeper/zookeeper.h&gt;</para>
+          </listitem>
+
+          <listitem>
+            <para>If you are building a multithreaded client, compile with
+            -DTHREADED compiler flag to enable the multi-threaded version of
+            the library, and then link against against the
+            <emphasis>zookeeper_mt</emphasis> library. If you are building a
+            single-threaded client, do not compile with -DTHREADED, and be
+            sure to link against the<emphasis> zookeeper_st
+            </emphasis>library.</para>
+          </listitem>
+        </orderedlist>
+
+        <note><para>See <filename>.../trunk/src/c/src/cli.c</filename>
+          for an example of a C client implementation</para>
+        </note>
+      </section>
+    </section>
+  </section>
+
+   <section id="ch_guideToZkOperations">
+    <title>Building Blocks: A Guide to ZooKeeper Operations</title>
+
+    <para>This section surveys all the operations a developer can perform
+    against a ZooKeeper server. It is lower level information than the earlier
+    concepts chapters in this manual, but higher level than the ZooKeeper API
+    Reference. It covers these topics:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><xref linkend="sc_connectingToZk" /></para>
+      </listitem>
+    </itemizedlist>
+
+    <section id="sc_errorsZk">
+      <title>Handling Errors</title>
+
+      <para>Both the Java and C client bindings may report errors. The Java client binding does so by throwing KeeperException, calling code() on the exception will return the specific error code. The C client binding returns an error code as defined in the enum ZOO_ERRORS. API callbacks indicate result code for both language bindings. See the API documentation (javadoc for Java, doxygen for C) for full details on the possible errors and their meaning.</para>
+    </section>
+    
+    <section id="sc_connectingToZk">
+      <title>Connecting to ZooKeeper</title>
+
+      <para>Before we begin, you will have to set up a running Zookeeper server so that we can start developing the client. For C client bindings, we will be using the multithreaded library(zookeeper_mt) with a simple example written in C. To establish a connection with Zookeeper server, we make use of C API - <emphasis>zookeeper_init</emphasis> with the following signature:</para>
+
+      <programlisting><emphasis>int</emphasis> <emphasis>zookeeper_init</emphasis>(<emphasis>const</emphasis> <emphasis>char</emphasis> *host, watcher_fn fn, <emphasis>int</emphasis> recv_timeout, <emphasis>const</emphasis> clientid_t *clientid, <emphasis>void</emphasis> *context, <emphasis>int</emphasis> flags);</programlisting>
+
+      <variablelist>
+        <varlistentry>
+          <term>*host</term>
+            <listitem>
+              <para>Connection string to zookeeper server in the format of host:port. If there are multiple servers, use comma as separator after specifying the host:port pairs. Eg: "127.0.0.1:2181,127.0.0.1:3001,127.0.0.1:3002"</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>fn</term>
+          <listitem>
+              <para>Watcher function to process events when a notification is triggered.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>recv_timeout</term>
+          <listitem>
+              <para>Session expiration time in milliseconds.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>*clientid</term>
+          <listitem>
+              <para>We can specify 0 for a new session. If a session has already establish previously, we could provide that client ID and it would reconnect to that previous session.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>*context</term>
+          <listitem>
+              <para>Context object that can be associated with the zkhandle_t handler. If it is not used, we can set it to 0.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>flags</term>
+          <listitem>
+              <para>In an initiation, we can leave it for 0.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+
+      <para>We will demonstrate client that outputs "Connected to Zookeeper" after successful connection or an error message otherwise. Let's call the following code <emphasis>zkClient.cc</emphasis> :</para>
+      <programlisting>
+#include &lt;stdio.h>
+#include &lt;zookeeper/zookeeper.h>
+#include &lt;errno.h>
+using namespace std;
+
+// Keeping track of the connection state
+static int connected = 0;
+static int expired   = 0;
+
+// *zkHandler handles the connection with Zookeeper
+static zhandle_t *zkHandler;
+
+// watcher function would process events
+void watcher(zhandle_t *zkH, int type, int state, const char *path, void *watcherCtx)
+{
+    if (type == ZOO_SESSION_EVENT) {
+
+        // state refers to states of zookeeper connection.
+        // To keep it simple, we would demonstrate these 3: ZOO_EXPIRED_SESSION_STATE, ZOO_CONNECTED_STATE, ZOO_NOTCONNECTED_STATE
+        // If you are using ACL, you should be aware of an authentication failure state - ZOO_AUTH_FAILED_STATE
+        if (state == ZOO_CONNECTED_STATE) {
+            connected = 1;
+        } else if (state == ZOO_NOTCONNECTED_STATE ) {
+            connected = 0;
+        } else if (state == ZOO_EXPIRED_SESSION_STATE) {
+            expired = 1;
+            connected = 0;
+            zookeeper_close(zkH);
+        }
+    }
+}
+
+int main(){
+    zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
+
+    // zookeeper_init returns the handler upon a successful connection, null otherwise
+    zkHandler = zookeeper_init("localhost:2181", watcher, 10000, 0, 0, 0);
+    
+    if (!zkHandler) {
+        return errno;
+    }else{
+        printf("Connection established with Zookeeper. \n");
+    }
+
+    // Close Zookeeper connection
+    zookeeper_close(zkHandler);
+
+    return 0;
+}
+      </programlisting>
+
+      <para>Compile the code with the multithreaded library mentioned before.</para>
+      <para><command>&gt; g++ -Iinclude/ zkClient.cpp -lzookeeper_mt -o Client</command></para>
+
+      <para>Run the client. </para>
+      <para><command>&gt; ./Client</command></para>
+
+      <para>From the output, you should see "Connected to Zookeeper" along with Zookeeper's DEBUG messages if the connection is successful.</para>
+
+    </section>
+    
+    <section id="sc_readOps">
+      <title>Read Operations</title>
+
+      <para></para>
+    </section>
+    
+    <section id="sc_writeOps">
+      <title>Write Operations</title>
+
+      <para></para>
+    </section>
+    
+    <section id="sc_handlingWatches">
+      <title>Handling Watches</title>
+
+      <para></para>
+    </section>
+    
+    <section id="sc_miscOps">
+      <title>Miscelleaneous ZooKeeper Operations</title>
+      <para></para>
+    </section>
+    
+
+  </section>
+
+  <section id="ch_programStructureWithExample">
+    <title>Program Structure, with Simple Example</title>
+
+    <para><emphasis>[tbd]</emphasis></para>
+  </section>
+
+  <section id="ch_gotchas">
+    <title>Gotchas: Common Problems and Troubleshooting</title>
+
+    <para>So now you know ZooKeeper. It's fast, simple, your application
+    works, but wait ... something's wrong. Here are some pitfalls that
+    ZooKeeper users fall into:</para>
+
+    <orderedlist>
+      <listitem>
+        <para>If you are using watches, you must look for the connected watch
+        event. When a ZooKeeper client disconnects from a server, you will
+        not receive notification of changes until reconnected. If you are
+        watching for a znode to come into existence, you will miss the event
+        if the znode is created and deleted while you are disconnected.</para>
+      </listitem>
+
+      <listitem>
+        <para>You must test ZooKeeper server failures. The ZooKeeper service
+        can survive failures as long as a majority of servers are active. The
+        question to ask is: can your application handle it? In the real world
+        a client's connection to ZooKeeper can break. (ZooKeeper server
+        failures and network partitions are common reasons for connection
+        loss.) The ZooKeeper client library takes care of recovering your
+        connection and letting you know what happened, but you must make sure
+        that you recover your state and any outstanding requests that failed.
+        Find out if you got it right in the test lab, not in production - test
+        with a ZooKeeper service made up of a several of

<TRUNCATED>

[05/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperAdmin.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperAdmin.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperAdmin.xml
new file mode 100644
index 0000000..62edb2a
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperAdmin.xml
@@ -0,0 +1,2353 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_Admin">
+  <title>ZooKeeper Administrator's Guide</title>
+
+  <subtitle>A Guide to Deployment and Administration</subtitle>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This document contains information about deploying, administering
+      and mantaining ZooKeeper. It also discusses best practices and common
+      problems.</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_deployment">
+    <title>Deployment</title>
+
+    <para>This section contains information about deploying Zookeeper and
+    covers these topics:</para>
+
+    <itemizedlist>
+      <listitem>
+        <para><xref linkend="sc_systemReq" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="sc_zkMulitServerSetup" /></para>
+      </listitem>
+
+      <listitem>
+        <para><xref linkend="sc_singleAndDevSetup" /></para>
+      </listitem>
+    </itemizedlist>
+
+    <para>The first two sections assume you are interested in installing
+    ZooKeeper in a production environment such as a datacenter. The final
+    section covers situations in which you are setting up ZooKeeper on a
+    limited basis - for evaluation, testing, or development - but not in a
+    production environment.</para>
+
+    <section id="sc_systemReq">
+      <title>System Requirements</title>
+
+      <section id="sc_supportedPlatforms">
+        <title>Supported Platforms</title>
+
+        <para>ZooKeeper consists of multiple components.  Some components are
+        supported broadly, and other components are supported only on a smaller
+        set of platforms.</para>
+
+        <itemizedlist>
+          <listitem>
+            <para><emphasis role="bold">Client</emphasis> is the Java client
+            library, used by applications to connect to a ZooKeeper ensemble.
+            </para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Server</emphasis> is the Java server
+            that runs on the ZooKeeper ensemble nodes.</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Native Client</emphasis> is a client
+            implemented in C, similar to the Java client, used by applications
+            to connect to a ZooKeeper ensemble.</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Contrib</emphasis> refers to multiple
+            optional add-on components.</para>
+          </listitem>
+        </itemizedlist>
+
+        <para>The following matrix describes the level of support committed for
+        running each component on different operating system platforms.</para>
+
+        <table>
+          <title>Support Matrix</title>
+          <tgroup cols="5" align="left" colsep="1" rowsep="1">
+            <thead>
+              <row>
+                <entry>Operating System</entry>
+                <entry>Client</entry>
+                <entry>Server</entry>
+                <entry>Native Client</entry>
+                <entry>Contrib</entry>
+              </row>
+            </thead>
+            <tbody>
+              <row>
+                <entry>GNU/Linux</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+              </row>
+              <row>
+                <entry>Solaris</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+                <entry>Not Supported</entry>
+                <entry>Not Supported</entry>
+              </row>
+              <row>
+                <entry>FreeBSD</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+                <entry>Not Supported</entry>
+                <entry>Not Supported</entry>
+              </row>
+              <row>
+                <entry>Windows</entry>
+                <entry>Development and Production</entry>
+                <entry>Development and Production</entry>
+                <entry>Not Supported</entry>
+                <entry>Not Supported</entry>
+              </row>
+              <row>
+                <entry>Mac OS X</entry>
+                <entry>Development Only</entry>
+                <entry>Development Only</entry>
+                <entry>Not Supported</entry>
+                <entry>Not Supported</entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+
+        <para>For any operating system not explicitly mentioned as supported in
+        the matrix, components may or may not work.  The ZooKeeper community
+        will fix obvious bugs that are reported for other platforms, but there
+        is no full support.</para>
+      </section>
+
+      <section id="sc_requiredSoftware">
+        <title>Required Software </title>
+
+        <para>ZooKeeper runs in Java, release 1.8 or greater (JDK 8 or
+        greater, FreeBSD support requires openjdk8).  It runs as an
+        <emphasis>ensemble</emphasis> of ZooKeeper servers. Three
+        ZooKeeper servers is the minimum recommended size for an
+        ensemble, and we also recommend that they run on separate
+        machines. At Yahoo!, ZooKeeper is usually deployed on
+        dedicated RHEL boxes, with dual-core processors, 2GB of RAM,
+        and 80GB IDE hard drives.</para>
+      </section>
+
+    </section>
+
+    <section id="sc_zkMulitServerSetup">
+      <title>Clustered (Multi-Server) Setup</title>
+
+      <para>For reliable ZooKeeper service, you should deploy ZooKeeper in a
+      cluster known as an <emphasis>ensemble</emphasis>. As long as a majority
+      of the ensemble are up, the service will be available. Because Zookeeper
+      requires a majority, it is best to use an
+      odd number of machines. For example, with four machines ZooKeeper can
+      only handle the failure of a single machine; if two machines fail, the
+      remaining two machines do not constitute a majority. However, with five
+      machines ZooKeeper can handle the failure of two machines. </para>
+      <note>
+         <para>
+            As mentioned in the
+            <ulink url="zookeeperStarted.html">ZooKeeper Getting Started Guide</ulink>
+            , a minimum of three servers are required for a fault tolerant
+            clustered setup, and it is strongly recommended that you have an
+            odd number of servers.
+         </para>
+         <para>Usually three servers is more than enough for a production
+            install, but for maximum reliability during maintenance, you may
+            wish to install five servers. With three servers, if you perform
+            maintenance on one of them, you are vulnerable to a failure on one
+            of the other two servers during that maintenance. If you have five
+            of them running, you can take one down for maintenance, and know
+            that you're still OK if one of the other four suddenly fails.
+         </para>
+         <para>Your redundancy considerations should include all aspects of
+            your environment. If you have three ZooKeeper servers, but their
+            network cables are all plugged into the same network switch, then
+            the failure of that switch will take down your entire ensemble.
+         </para>
+      </note>
+      <para>Here are the steps to setting a server that will be part of an
+      ensemble. These steps should be performed on every host in the
+      ensemble:</para>
+
+      <orderedlist>
+        <listitem>
+          <para>Install the Java JDK. You can use the native packaging system
+          for your system, or download the JDK from:</para>
+
+          <para><ulink
+          url="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</ulink></para>
+        </listitem>
+
+        <listitem>
+          <para>Set the Java heap size. This is very important to avoid
+          swapping, which will seriously degrade ZooKeeper performance. To
+          determine the correct value, use load tests, and make sure you are
+          well below the usage limit that would cause you to swap. Be
+          conservative - use a maximum heap size of 3GB for a 4GB
+          machine.</para>
+        </listitem>
+
+        <listitem>
+          <para>Install the ZooKeeper Server Package. It can be downloaded
+            from:
+          </para>
+          <para>
+            <ulink url="http://zookeeper.apache.org/releases.html">
+              http://zookeeper.apache.org/releases.html
+            </ulink>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>Create a configuration file. This file can be called anything.
+          Use the following settings as a starting point:</para>
+
+          <programlisting>
+tickTime=2000
+dataDir=/var/lib/zookeeper/
+clientPort=2181
+initLimit=5
+syncLimit=2
+server.1=zoo1:2888:3888
+server.2=zoo2:2888:3888
+server.3=zoo3:2888:3888</programlisting>
+
+          <para>You can find the meanings of these and other configuration
+          settings in the section <xref linkend="sc_configuration" />. A word
+          though about a few here:</para>
+
+          <para>Every machine that is part of the ZooKeeper ensemble should know
+          about every other machine in the ensemble. You accomplish this with
+          the series of lines of the form <emphasis
+          role="bold">server.id=host:port:port</emphasis>. The parameters <emphasis
+          role="bold">host</emphasis> and <emphasis
+          role="bold">port</emphasis> are straightforward. You attribute the
+          server id to each machine by creating a file named
+          <filename>myid</filename>, one for each server, which resides in
+          that server's data directory, as specified by the configuration file
+          parameter <emphasis role="bold">dataDir</emphasis>.</para></listitem>
+
+          <listitem><para>The myid file
+          consists of a single line containing only the text of that machine's
+          id. So <filename>myid</filename> of server 1 would contain the text
+          "1" and nothing else. The id must be unique within the
+          ensemble and should have a value between 1 and 255. <emphasis role="bold">IMPORTANT:</emphasis> if you
+          enable extended features such as TTL Nodes (see below) the id must be
+          between 1 and 254 due to internal limitations.</para>
+        </listitem>
+
+        <listitem>
+          <para>Create an initialization marker file <filename>initialize</filename>
+            in the same directory as <filename>myid</filename>. This file indicates
+            that an empty data directory is expected. When present, an empty data base
+            is created and the marker file deleted. When not present, an empty data
+            directory will mean this peer will not have voting rights and it will not
+            populate the data directory until it communicates with an active leader.
+            Intended use is to only create this file when bringing up a new
+            ensemble. </para>
+        </listitem>
+        <listitem>
+          <para>If your configuration file is set up, you can start a
+          ZooKeeper server:</para>
+
+          <para><computeroutput>$ java -cp zookeeper.jar:lib/slf4j-api-1.7.5.jar:lib/slf4j-log4j12-1.7.5.jar:lib/log4j-1.2.17.jar:conf \
+              org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg
+          </computeroutput></para>
+          
+          <para>QuorumPeerMain starts a ZooKeeper server,
+            <ulink url="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">JMX</ulink>
+            management beans are also registered which allows
+            management through a JMX management console. 
+            The <ulink url="zookeeperJMX.html">ZooKeeper JMX
+            document</ulink> contains details on managing ZooKeeper with JMX.
+          </para>
+
+          <para>See the script <emphasis>bin/zkServer.sh</emphasis>,
+            which is included in the release, for an example
+            of starting server instances.</para>
+
+        </listitem>
+
+        <listitem>
+          <para>Test your deployment by connecting to the hosts:</para>
+
+          <para>In Java, you can run the following command to execute
+          simple operations:</para>
+
+          <para><computeroutput>$ bin/zkCli.sh -server 127.0.0.1:2181</computeroutput></para>
+        </listitem>
+      </orderedlist>
+    </section>
+
+    <section id="sc_singleAndDevSetup">
+      <title>Single Server and Developer Setup</title>
+
+      <para>If you want to setup ZooKeeper for development purposes, you will
+      probably want to setup a single server instance of ZooKeeper, and then
+      install either the Java or C client-side libraries and bindings on your
+      development machine.</para>
+
+      <para>The steps to setting up a single server instance are the similar
+      to the above, except the configuration file is simpler. You can find the
+      complete instructions in the <ulink
+      url="zookeeperStarted.html#sc_InstallingSingleMode">Installing and
+      Running ZooKeeper in Single Server Mode</ulink> section of the <ulink
+      url="zookeeperStarted.html">ZooKeeper Getting Started
+      Guide</ulink>.</para>
+
+      <para>For information on installing the client side libraries, refer to
+      the <ulink url="zookeeperProgrammers.html#Bindings">Bindings</ulink>
+      section of the <ulink url="zookeeperProgrammers.html">ZooKeeper
+      Programmer's Guide</ulink>.</para>
+    </section>
+  </section>
+
+  <section id="ch_administration">
+    <title>Administration</title>
+
+    <para>This section contains information about running and maintaining
+    ZooKeeper and covers these topics: </para>
+    <itemizedlist>
+        <listitem>
+          <para><xref linkend="sc_designing" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_provisioning" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_strengthsAndLimitations" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_administering" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_maintenance" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_supervision" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_monitoring" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_logging" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_troubleshooting" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_configuration" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_zkCommands" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_dataFileManagement" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_commonProblems" /></para>
+        </listitem>
+
+        <listitem>
+          <para><xref linkend="sc_bestPractices" /></para>
+        </listitem>
+      </itemizedlist>
+
+    <section id="sc_designing">
+      <title>Designing a ZooKeeper Deployment</title>
+
+      <para>The reliability of ZooKeeper rests on two basic assumptions.</para>
+      <orderedlist>
+        <listitem><para> Only a minority of servers in a deployment
+            will fail. <emphasis>Failure</emphasis> in this context
+            means a machine crash, or some error in the network that
+            partitions a server off from the majority.</para>
+        </listitem>
+        <listitem><para> Deployed machines operate correctly. To
+            operate correctly means to execute code correctly, to have
+            clocks that work properly, and to have storage and network
+            components that perform consistently.</para>
+        </listitem>
+      </orderedlist>
+    
+    <para>The sections below contain considerations for ZooKeeper
+      administrators to maximize the probability for these assumptions
+      to hold true. Some of these are cross-machines considerations,
+      and others are things you should consider for each and every
+      machine in your deployment.</para>
+
+    <section id="sc_CrossMachineRequirements">
+      <title>Cross Machine Requirements</title>
+    
+      <para>For the ZooKeeper service to be active, there must be a
+        majority of non-failing machines that can communicate with
+        each other. To create a deployment that can tolerate the
+        failure of F machines, you should count on deploying 2xF+1
+        machines.  Thus, a deployment that consists of three machines
+        can handle one failure, and a deployment of five machines can
+        handle two failures. Note that a deployment of six machines
+        can only handle two failures since three machines is not a
+        majority.  For this reason, ZooKeeper deployments are usually
+        made up of an odd number of machines.</para>
+
+      <para>To achieve the highest probability of tolerating a failure
+        you should try to make machine failures independent. For
+        example, if most of the machines share the same switch,
+        failure of that switch could cause a correlated failure and
+        bring down the service. The same holds true of shared power
+        circuits, cooling systems, etc.</para>
+    </section>
+
+    <section>
+      <title>Single Machine Requirements</title>
+
+      <para>If ZooKeeper has to contend with other applications for
+        access to resources like storage media, CPU, network, or
+        memory, its performance will suffer markedly.  ZooKeeper has
+        strong durability guarantees, which means it uses storage
+        media to log changes before the operation responsible for the
+        change is allowed to complete. You should be aware of this
+        dependency then, and take great care if you want to ensure
+        that ZooKeeper operations aren’t held up by your media. Here
+        are some things you can do to minimize that sort of
+        degradation:
+      </para>
+
+      <itemizedlist>
+        <listitem>
+          <para>ZooKeeper's transaction log must be on a dedicated
+            device. (A dedicated partition is not enough.) ZooKeeper
+            writes the log sequentially, without seeking Sharing your
+            log device with other processes can cause seeks and
+            contention, which in turn can cause multi-second
+            delays.</para>
+        </listitem>
+
+        <listitem>
+          <para>Do not put ZooKeeper in a situation that can cause a
+            swap. In order for ZooKeeper to function with any sort of
+            timeliness, it simply cannot be allowed to swap.
+            Therefore, make certain that the maximum heap size given
+            to ZooKeeper is not bigger than the amount of real memory
+            available to ZooKeeper.  For more on this, see
+            <xref linkend="sc_commonProblems"/>
+            below. </para>
+        </listitem>
+      </itemizedlist>
+    </section>
+    </section>
+
+    <section id="sc_provisioning">
+      <title>Provisioning</title>
+
+      <para></para>
+    </section>
+
+    <section id="sc_strengthsAndLimitations">
+      <title>Things to Consider: ZooKeeper Strengths and Limitations</title>
+
+      <para></para>
+    </section>
+
+    <section id="sc_administering">
+      <title>Administering</title>
+
+      <para></para>
+    </section>
+
+    <section id="sc_maintenance">
+      <title>Maintenance</title>
+
+      <para>Little long term maintenance is required for a ZooKeeper
+        cluster however you must be aware of the following:</para>
+
+      <section>
+        <title>Ongoing Data Directory Cleanup</title>
+
+        <para>The ZooKeeper <ulink url="#var_datadir">Data
+          Directory</ulink> contains files which are a persistent copy
+          of the znodes stored by a particular serving ensemble. These
+          are the snapshot and transactional log files. As changes are
+          made to the znodes these changes are appended to a
+          transaction log. Occasionally, when a log grows large, a
+          snapshot of the current state of all znodes will be written
+          to the filesystem and a new transaction log file is created
+          for future transactions. During snapshotting, ZooKeeper may
+          continue appending incoming transactions to the old log file.
+          Therefore, some transactions which are newer than a snapshot
+          may be found in the last transaction log preceding the
+          snapshot.
+        </para>
+
+        <para>A ZooKeeper server <emphasis role="bold">will not remove
+        old snapshots and log files</emphasis> when using the default
+        configuration (see autopurge below), this is the
+        responsibility of the operator. Every serving environment is
+        different and therefore the requirements of managing these
+        files may differ from install to install (backup for example).
+        </para>
+
+        <para>The PurgeTxnLog utility implements a simple retention
+        policy that administrators can use. The <ulink
+        url="ext:api/index">API docs</ulink> contains details on
+        calling conventions (arguments, etc...).
+        </para>
+
+        <para>In the following example the last count snapshots and
+        their corresponding logs are retained and the others are
+        deleted.  The value of &lt;count&gt; should typically be
+        greater than 3 (although not required, this provides 3 backups
+        in the unlikely event a recent log has become corrupted). This
+        can be run as a cron job on the ZooKeeper server machines to
+        clean up the logs daily.</para>
+
+        <programlisting> java -cp zookeeper.jar:lib/slf4j-api-1.7.5.jar:lib/slf4j-log4j12-1.7.5.jar:lib/log4j-1.2.17.jar:conf org.apache.zookeeper.server.PurgeTxnLog &lt;dataDir&gt; &lt;snapDir&gt; -n &lt;count&gt;</programlisting>
+
+        <para>Automatic purging of the snapshots and corresponding
+        transaction logs was introduced in version 3.4.0 and can be
+        enabled via the following configuration parameters <emphasis
+        role="bold">autopurge.snapRetainCount</emphasis> and <emphasis
+        role="bold">autopurge.purgeInterval</emphasis>. For more on
+        this, see <xref linkend="sc_advancedConfiguration"/>
+        below.</para>
+      </section>
+
+      <section>
+        <title>Debug Log Cleanup (log4j)</title>
+
+        <para>See the section on <ulink
+        url="#sc_logging">logging</ulink> in this document. It is
+        expected that you will setup a rolling file appender using the
+        in-built log4j feature. The sample configuration file in the
+        release tar's conf/log4j.properties provides an example of
+        this.
+        </para>
+      </section>
+
+    </section>
+
+    <section id="sc_supervision">
+      <title>Supervision</title>
+
+      <para>You will want to have a supervisory process that manages
+      each of your ZooKeeper server processes (JVM). The ZK server is
+      designed to be "fail fast" meaning that it will shutdown
+      (process exit) if an error occurs that it cannot recover
+      from. As a ZooKeeper serving cluster is highly reliable, this
+      means that while the server may go down the cluster as a whole
+      is still active and serving requests. Additionally, as the
+      cluster is "self healing" the failed server once restarted will
+      automatically rejoin the ensemble w/o any manual
+      interaction.</para>
+
+      <para>Having a supervisory process such as <ulink
+      url="http://cr.yp.to/daemontools.html">daemontools</ulink> or
+      <ulink
+      url="http://en.wikipedia.org/wiki/Service_Management_Facility">SMF</ulink>
+      (other options for supervisory process are also available, it's
+      up to you which one you would like to use, these are just two
+      examples) managing your ZooKeeper server ensures that if the
+      process does exit abnormally it will automatically be restarted
+      and will quickly rejoin the cluster.</para>
+
+      <para>It is also recommended to configure the ZooKeeper server process to
+      terminate and dump its heap if an
+      <computeroutput>OutOfMemoryError</computeroutput> occurs.  This is achieved
+      by launching the JVM with the following arguments on Linux and Windows
+      respectively.  The <filename>zkServer.sh</filename> and
+      <filename>zkServer.cmd</filename> scripts that ship with ZooKeeper set
+      these options.
+      </para>
+
+      <programlisting>-XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError='kill -9 %p'</programlisting>
+      <programlisting>"-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f"</programlisting>
+    </section>
+
+    <section id="sc_monitoring">
+      <title>Monitoring</title>
+
+      <para>The ZooKeeper service can be monitored in one of two
+      primary ways; 1) the command port through the use of <ulink
+      url="#sc_zkCommands">4 letter words</ulink> and 2) <ulink
+      url="zookeeperJMX.html">JMX</ulink>. See the appropriate section for
+      your environment/requirements.</para>
+    </section>
+
+    <section id="sc_logging">
+      <title>Logging</title>
+
+    <para>
+        ZooKeeper uses <emphasis role="bold"><ulink url="http://www.slf4j.org">SLF4J</ulink></emphasis>
+        version 1.7.5 as its logging infrastructure. For backward compatibility it is bound to
+        <emphasis role="bold">LOG4J</emphasis> but you can use
+        <emphasis role="bold"><ulink url="http://logback.qos.ch/">LOGBack</ulink></emphasis>
+        or any other supported logging framework of your choice.
+    </para>
+    <para>
+        The ZooKeeper default <filename>log4j.properties</filename>
+        file resides in the <filename>conf</filename> directory. Log4j requires that
+        <filename>log4j.properties</filename> either be in the working directory
+        (the directory from which ZooKeeper is run) or be accessible from the classpath.
+    </para>
+
+    <para>For more information about SLF4J, see
+      <ulink url="http://www.slf4j.org/manual.html">its manual</ulink>.</para>
+
+    <para>For more information about LOG4J, see
+      <ulink url="http://logging.apache.org/log4j/1.2/manual.html#defaultInit">Log4j Default Initialization Procedure</ulink> 
+      of the log4j manual.</para>
+      
+    </section>
+
+    <section id="sc_troubleshooting">
+      <title>Troubleshooting</title>
+	<variablelist>
+		<varlistentry>
+		<term> Server not coming up because of file corruption</term>
+		<listitem>
+		<para>A server might not be able to read its database and fail to come up because of 
+		some file corruption in the transaction logs of the ZooKeeper server. You will
+		see some IOException on loading ZooKeeper database. In such a case,
+		make sure all the other servers in your ensemble are up and  working. Use "stat" 
+		command on the command port to see if they are in good health. After you have verified that
+		all the other servers of the ensemble are up, you can go ahead and clean the database
+		of the corrupt server. Delete all the files in datadir/version-2 and datalogdir/version-2/.
+		Restart the server.
+		</para>
+		</listitem>
+		</varlistentry>
+		</variablelist>
+    </section>
+
+    <section id="sc_configuration">
+      <title>Configuration Parameters</title>
+
+      <para>ZooKeeper's behavior is governed by the ZooKeeper configuration
+      file. This file is designed so that the exact same file can be used by
+      all the servers that make up a ZooKeeper server assuming the disk
+      layouts are the same. If servers use different configuration files, care
+      must be taken to ensure that the list of servers in all of the different
+      configuration files match.</para>
+
+      <note>
+        <para>In 3.5.0 and later, some of these parameters should be placed in
+         a dynamic configuration file. If they are placed in the static
+         configuration file, ZooKeeper will automatically move them over to the
+         dynamic configuration file. See <ulink url="zookeeperReconfig.html">
+         Dynamic Reconfiguration</ulink> for more information.</para>
+      </note>
+
+      <section id="sc_minimumConfiguration">
+        <title>Minimum Configuration</title>
+
+        <para>Here are the minimum configuration keywords that must be defined
+        in the configuration file:</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>clientPort</term>
+
+            <listitem>
+              <para>the port to listen for client connections; that is, the
+              port that clients attempt to connect to.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>secureClientPort</term>
+
+            <listitem>
+              <para>the port to listen on for secure client connections using SSL.
+
+              <emphasis role="bold">clientPort</emphasis> specifies
+                the port for plaintext connections while <emphasis role="bold">
+                  secureClientPort</emphasis> specifies the port for SSL
+                connections. Specifying both enables mixed-mode while omitting
+                either will disable that mode.</para>
+              <para>Note that SSL feature will be enabled when user plugs-in
+                zookeeper.serverCnxnFactory, zookeeper.clientCnxnSocket as Netty.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry id="var_datadir">
+            <term>dataDir</term>
+
+            <listitem>
+              <para>the location where ZooKeeper will store the in-memory
+              database snapshots and, unless specified otherwise, the
+              transaction log of updates to the database.</para>
+
+              <note>
+                <para>Be careful where you put the transaction log. A
+                dedicated transaction log device is key to consistent good
+                performance. Putting the log on a busy device will adversely
+                effect performance.</para>
+              </note>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry id="id_tickTime">
+            <term>tickTime</term>
+
+            <listitem>
+              <para>the length of a single tick, which is the basic time unit
+              used by ZooKeeper, as measured in milliseconds. It is used to
+              regulate heartbeats, and timeouts. For example, the minimum
+              session timeout will be two ticks.</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </section>
+
+      <section id="sc_advancedConfiguration">
+        <title>Advanced Configuration</title>
+
+        <para>The configuration settings in the section are optional. You can
+        use them to further fine tune the behaviour of your ZooKeeper servers.
+        Some can also be set using Java system properties, generally of the
+        form <emphasis>zookeeper.keyword</emphasis>. The exact system
+        property, when available, is noted below.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>dataLogDir</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>This option will direct the machine to write the
+              transaction log to the <emphasis
+              role="bold">dataLogDir</emphasis> rather than the <emphasis
+              role="bold">dataDir</emphasis>. This allows a dedicated log
+              device to be used, and helps avoid competition between logging
+              and snapshots.</para>
+
+              <note>
+                <para>Having a dedicated log device has a large impact on
+                throughput and stable latencies. It is highly recommended to
+                dedicate a log device and set <emphasis
+                role="bold">dataLogDir</emphasis> to point to a directory on
+                that device, and then make sure to point <emphasis
+                role="bold">dataDir</emphasis> to a directory
+                <emphasis>not</emphasis> residing on that device.</para>
+              </note>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>globalOutstandingLimit</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.globalOutstandingLimit.</emphasis>)</para>
+
+              <para>Clients can submit requests faster than ZooKeeper can
+              process them, especially if there are a lot of clients. To
+              prevent ZooKeeper from running out of memory due to queued
+              requests, ZooKeeper will throttle clients so that there is no
+              more than globalOutstandingLimit outstanding requests in the
+              system. The default limit is 1,000.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>preAllocSize</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.preAllocSize</emphasis>)</para>
+
+              <para>To avoid seeks ZooKeeper allocates space in the
+              transaction log file in blocks of preAllocSize kilobytes. The
+              default block size is 64M. One reason for changing the size of
+              the blocks is to reduce the block size if snapshots are taken
+              more often. (Also, see <emphasis
+              role="bold">snapCount</emphasis>).</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>snapCount</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.snapCount</emphasis>)</para>
+
+              <para>ZooKeeper records its transactions using snapshots and
+              a transaction log (think write-ahead log).The number of
+              transactions recorded in the transaction log before a snapshot
+              can be taken (and the transaction log rolled) is determined
+              by snapCount. In order to prevent all of the machines in the quorum
+              from taking a snapshot at the same time, each ZooKeeper server
+              will take a snapshot when the number of transactions in the transaction log
+              reaches a runtime generated random value in the [snapCount/2+1, snapCount] 
+              range.The default snapCount is 100,000.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>maxClientCnxns</term>
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Limits the number of concurrent connections (at the socket 
+              level) that a single client, identified by IP address, may make
+              to a single member of the ZooKeeper ensemble. This is used to 
+              prevent certain classes of DoS attacks, including file 
+              descriptor exhaustion. The default is 60. Setting this to 0
+              entirely removes the limit on concurrent connections.</para>
+            </listitem>
+           </varlistentry>
+
+           <varlistentry>
+             <term>clientPortAddress</term>
+
+             <listitem>
+               <para><emphasis role="bold">New in 3.3.0:</emphasis> the
+               address (ipv4, ipv6 or hostname) to listen for client
+               connections; that is, the address that clients attempt
+               to connect to. This is optional, by default we bind in
+               such a way that any connection to the <emphasis
+               role="bold">clientPort</emphasis> for any
+               address/interface/nic on the server will be
+               accepted.</para>
+             </listitem>
+           </varlistentry>
+
+          <varlistentry>
+            <term>minSessionTimeout</term>
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> the
+              minimum session timeout in milliseconds that the server
+              will allow the client to negotiate. Defaults to 2 times
+              the <emphasis role="bold">tickTime</emphasis>.</para>
+            </listitem>
+           </varlistentry>
+
+          <varlistentry>
+            <term>maxSessionTimeout</term>
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> the
+              maximum session timeout in milliseconds that the server
+              will allow the client to negotiate. Defaults to 20 times
+              the <emphasis role="bold">tickTime</emphasis>.</para>
+            </listitem>
+           </varlistentry>
+           
+           <varlistentry>
+             <term>fsync.warningthresholdms</term>
+             <listitem>
+               <para>(Java system property: <emphasis
+               role="bold">zookeeper.fsync.warningthresholdms</emphasis>)</para>
+
+               <para><emphasis role="bold">New in 3.3.4:</emphasis> A
+               warning message will be output to the log whenever an
+               fsync in the Transactional Log (WAL) takes longer than
+               this value. The values is specified in milliseconds and
+               defaults to 1000. This value can only be set as a
+               system property.</para>
+             </listitem>
+           </varlistentry>
+
+          <varlistentry>
+            <term>autopurge.snapRetainCount</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.4.0:</emphasis> 
+              When enabled, ZooKeeper auto purge feature retains
+              the <emphasis role="bold">autopurge.snapRetainCount</emphasis> most
+              recent snapshots and the corresponding transaction logs in the 
+              <emphasis role="bold">dataDir</emphasis> and <emphasis 
+              role="bold">dataLogDir</emphasis> respectively and deletes the rest.
+              Defaults to 3. Minimum value is 3.</para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>autopurge.purgeInterval</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.4.0:</emphasis> The
+              time interval in hours for which the purge task has to
+              be triggered. Set to a positive integer (1 and above)
+              to enable the auto purging. Defaults to 0.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>syncEnabled</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.observer.syncEnabled</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.4.6, 3.5.0:</emphasis>
+              The observers now log transaction and write snapshot to disk
+              by default like the participants. This reduces the recovery time
+              of the observers on restart. Set to "false" to disable this
+              feature. Default is "true"</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>zookeeper.extendedTypesEnabled</term>
+
+            <listitem>
+                <para>(Java system property only: <emphasis
+                    role="bold">zookeeper.extendedTypesEnabled</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.5.4, 3.6.0:</emphasis> Define to "true" to enable
+              extended features such as the creation of <ulink url="zookeeperProgrammers.html#TTL+Nodes">TTL Nodes</ulink>.
+              They are disabled by default. IMPORTANT: when enabled server IDs must
+              be less than 255 due to internal limitations.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>zookeeper.emulate353TTLNodes</term>
+
+            <listitem>
+                <para>(Java system property only: <emphasis
+                    role="bold">zookeeper.emulate353TTLNodes</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.5.4, 3.6.0:</emphasis> Due to
+                <ulink url="https://issues.apache.org/jira/browse/ZOOKEEPER-2901">ZOOKEEPER-2901</ulink> TTL nodes
+                created in version 3.5.3 are not supported in 3.5.4/3.6.0. However, a workaround is provided via the
+                zookeeper.emulate353TTLNodes system property. If you used TTL nodes in ZooKeeper 3.5.3 and need to maintain
+                compatibility set <emphasis role="bold">zookeeper.emulate353TTLNodes</emphasis> to "true" in addition to
+                <emphasis role="bold">zookeeper.extendedTypesEnabled</emphasis>. NOTE: due to the bug, server IDs
+                must be 127 or less. Additionally, the maximum support TTL value is 1099511627775 which is smaller
+                than what was allowed in 3.5.3 (1152921504606846975)</para>
+            </listitem>
+          </varlistentry>
+
+        </variablelist>
+      </section>
+
+      <section id="sc_clusterOptions">
+        <title>Cluster Options</title>
+
+        <para>The options in this section are designed for use with an ensemble
+        of servers -- that is, when deploying clusters of servers.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>electionAlg</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Election implementation to use. A value of "1" corresponds to the
+              non-authenticated UDP-based version of fast leader election, "2"
+              corresponds to the authenticated UDP-based version of fast
+              leader election, and "3" corresponds to TCP-based version of
+              fast leader election. Currently, algorithm 3 is the default.</para>
+              
+              <note>
+              <para> The implementations of leader election 1, and 2 are now
+              <emphasis role="bold"> deprecated </emphasis>. We have the intention
+              of removing them in the next release, at which point only the 
+              FastLeaderElection will be available. 
+              </para>
+              </note>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>initLimit</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Amount of time, in ticks (see <ulink
+              url="#id_tickTime">tickTime</ulink>), to allow followers to
+              connect and sync to a leader. Increased this value as needed, if
+              the amount of data managed by ZooKeeper is large.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>leaderServes</term>
+
+            <listitem>
+              <para>(Java system property: zookeeper.<emphasis
+              role="bold">leaderServes</emphasis>)</para>
+
+              <para>Leader accepts client connections. Default value is "yes".
+              The leader machine coordinates updates. For higher update
+              throughput at the slight expense of read throughput the leader
+              can be configured to not accept clients and focus on
+              coordination. The default to this option is yes, which means
+              that a leader will accept client connections.</para>
+
+              <note>
+                <para>Turning on leader selection is highly recommended when
+                you have more than three ZooKeeper servers in an ensemble.</para>
+              </note>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>server.x=[hostname]:nnnnn[:nnnnn], etc</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>servers making up the ZooKeeper ensemble. When the server
+              starts up, it determines which server it is by looking for the
+              file <filename>myid</filename> in the data directory. That file
+              contains the server number, in ASCII, and it should match
+              <emphasis role="bold">x</emphasis> in <emphasis
+              role="bold">server.x</emphasis> in the left hand side of this
+              setting.</para>
+
+              <para>The list of servers that make up ZooKeeper servers that is
+              used by the clients must match the list of ZooKeeper servers
+              that each ZooKeeper server has.</para>
+
+              <para>There are two port numbers <emphasis role="bold">nnnnn</emphasis>. 
+              The first followers use to connect to the leader, and the second is for 
+              leader election. If you want to test multiple servers on a single machine, then
+              different ports can be used for each server.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>syncLimit</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Amount of time, in ticks (see <ulink
+              url="#id_tickTime">tickTime</ulink>), to allow followers to sync
+              with ZooKeeper. If followers fall too far behind a leader, they
+              will be dropped.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>group.x=nnnnn[:nnnnn]</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Enables a hierarchical quorum construction."x" is a group identifier
+              and the numbers following the "=" sign correspond to server identifiers. 
+              The left-hand side of the assignment is a colon-separated list of server
+              identifiers. Note that groups must be disjoint and the union of all groups
+              must be the ZooKeeper ensemble. </para>
+              
+              <para> You will find an example <ulink url="zookeeperHierarchicalQuorums.html">here</ulink>
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>weight.x=nnnnn</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para>Used along with "group", it assigns a weight to a server when
+              forming quorums. Such a value corresponds to the weight of a server
+              when voting. There are a few parts of ZooKeeper that require voting
+              such as leader election and the atomic broadcast protocol. By default
+              the weight of server is 1. If the configuration defines groups, but not
+              weights, then a value of 1 will be assigned to all servers.  
+              </para>
+              
+              <para> You will find an example <ulink url="zookeeperHierarchicalQuorums.html">here</ulink>
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>cnxTimeout</term>
+
+            <listitem>
+              <para>(Java system property: zookeeper.<emphasis
+              role="bold">cnxTimeout</emphasis>)</para>
+
+              <para>Sets the timeout value for opening connections for leader election notifications. 
+              Only applicable if you are using electionAlg 3. 
+              </para>
+
+              <note>
+                <para>Default value is 5 seconds.</para>
+              </note>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>standaloneEnabled</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.5.0:</emphasis>
+              When set to false, a single server can be started in replicated
+              mode, a lone participant can run with observers, and a cluster
+              can reconfigure down to one node, and up from one node. The
+              default is true for backwards compatibility. It can be set
+              using QuorumPeerConfig's setStandaloneEnabled method or by
+              adding "standaloneEnabled=false" or "standaloneEnabled=true"
+              to a server's config file.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>reconfigEnabled</term>
+
+            <listitem>
+              <para>(No Java system property)</para>
+
+              <para><emphasis role="bold">New in 3.5.3:</emphasis>
+                This controls the enabling or disabling of
+                <ulink url="zookeeperReconfig.html">
+                  Dynamic Reconfiguration</ulink> feature. When the feature
+                is enabled, users can perform reconfigure operations through
+                the ZooKeeper client API or through ZooKeeper command line tools
+                assuming users are authorized to perform such operations.
+                When the feature is disabled, no user, including the super user,
+                can perform a reconfiguration. Any attempt to reconfigure will return an error.
+                <emphasis role="bold">"reconfigEnabled"</emphasis> option can be set as
+                <emphasis role="bold">"reconfigEnabled=false"</emphasis> or
+                <emphasis role="bold">"reconfigEnabled=true"</emphasis>
+                to a server's config file, or using QuorumPeerConfig's
+                setReconfigEnabled method. The default value is false.
+
+                If present, the value should be consistent across every server in
+                the entire ensemble. Setting the value as true on some servers and false
+                on other servers will cause inconsistent behavior depending on which server
+                is elected as leader. If the leader has a setting of
+                <emphasis role="bold">"reconfigEnabled=true"</emphasis>, then the ensemble
+                will have reconfig feature enabled. If the leader has a setting of
+                <emphasis role="bold">"reconfigEnabled=false"</emphasis>, then the ensemble
+                will have reconfig feature disabled. It is thus recommended to have a consistent
+                value for <emphasis role="bold">"reconfigEnabled"</emphasis> across servers
+                in the ensemble.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>4lw.commands.whitelist</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+                      role="bold">zookeeper.4lw.commands.whitelist</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.5.3:</emphasis>
+                A list of comma separated <ulink url="#sc_4lw">Four Letter Words</ulink>
+                commands that user wants to use. A valid Four Letter Words
+                command must be put in this list else ZooKeeper server will
+                not enable the command.
+                By default the whitelist only contains "srvr" command
+                which zkServer.sh uses. The rest of four letter word commands are disabled
+                by default.
+              </para>
+
+              <para>Here's an example of the configuration that enables stat, ruok, conf, and isro
+              command while disabling the rest of Four Letter Words command:</para>
+              <programlisting>
+                4lw.commands.whitelist=stat, ruok, conf, isro
+              </programlisting>
+
+              <para>If you really need enable all four letter word commands by default, you can use
+                the asterisk option so you don't have to include every command one by one in the list.
+                As an example, this will enable all four letter word commands:
+              </para>
+              <programlisting>
+                4lw.commands.whitelist=*
+              </programlisting>
+
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>tcpKeepAlive</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+                      role="bold">zookeeper.tcpKeepAlive</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.5.4:</emphasis>
+                Setting this to true sets the TCP keepAlive flag on the
+                sockets used by quorum members to perform elections.
+                This will allow for connections between quorum members to
+                remain up when there is network infrastructure that may
+                otherwise break them. Some NATs and firewalls may terminate
+                or lose state for long running or idle connections.</para>
+
+              <para> Enabling this option relies on OS level settings to work
+                properly, check your operating system's options regarding TCP
+                keepalive for more information.  Defaults to
+                <emphasis role="bold">false</emphasis>.
+              </para>
+            </listitem>
+          </varlistentry>
+
+        </variablelist>
+        <para></para>
+      </section>
+
+      <section id="sc_authOptions">
+        <title>Encryption, Authentication, Authorization Options</title>
+
+        <para>The options in this section allow control over
+        encryption/authentication/authorization performed by the service.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>DigestAuthenticationProvider.superDigest</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.DigestAuthenticationProvider.superDigest</emphasis>)</para>
+
+              <para>By default this feature is <emphasis
+              role="bold">disabled</emphasis></para>
+
+              <para><emphasis role="bold">New in 3.2:</emphasis>
+              Enables a ZooKeeper ensemble administrator to access the
+              znode hierarchy as a "super" user. In particular no ACL
+              checking occurs for a user authenticated as
+              super.</para>
+
+              <para>org.apache.zookeeper.server.auth.DigestAuthenticationProvider
+              can be used to generate the superDigest, call it with
+              one parameter of "super:&lt;password>". Provide the
+              generated "super:&lt;data>" as the system property value
+              when starting each server of the ensemble.</para>
+
+              <para>When authenticating to a ZooKeeper server (from a
+              ZooKeeper client) pass a scheme of "digest" and authdata
+              of "super:&lt;password>". Note that digest auth passes
+              the authdata in plaintext to the server, it would be
+              prudent to use this authentication method only on
+              localhost (not over the network) or over an encrypted
+              connection.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>X509AuthenticationProvider.superUser</term>
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.X509AuthenticationProvider.superUser</emphasis>)</para>
+
+              <para>The SSL-backed way to enable a ZooKeeper ensemble
+              administrator to access the znode hierarchy as a "super" user.
+              When this parameter is set to an X500 principal name, only an
+              authenticated client with that principal will be able to bypass
+              ACL checking and have full privileges to all znodes.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>zookeeper.superUser</term>
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.superUser</emphasis>)</para>
+
+              <para>Similar to <emphasis role="bold">zookeeper.X509AuthenticationProvider.superUser</emphasis>
+              but is generic for SASL based logins. It stores the name of 
+              a user that can access the znode hierarchy as a "super" user.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>ssl.keyStore.location and ssl.keyStore.password</term>
+            <listitem>
+              <para>(Java system properties: <emphasis role="bold">
+                zookeeper.ssl.keyStore.location</emphasis> and <emphasis
+                      role="bold">zookeeper.ssl.keyStore.password</emphasis>)</para>
+
+              <para>Specifies the file path to a JKS containing the local
+                credentials to be used for SSL connections, and the
+                password to unlock the file.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>ssl.trustStore.location and ssl.trustStore.password</term>
+            <listitem>
+              <para>(Java system properties: <emphasis role="bold">
+                zookeeper.ssl.trustStore.location</emphasis> and <emphasis
+                      role="bold">zookeeper.ssl.trustStore.password</emphasis>)</para>
+
+              <para>Specifies the file path to a JKS containing the remote
+                credentials to be used for SSL connections, and the
+                password to unlock the file.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>ssl.authProvider</term>
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.ssl.authProvider</emphasis>)</para>
+
+              <para>Specifies a subclass of <emphasis role="bold">
+              org.apache.zookeeper.auth.X509AuthenticationProvider</emphasis>
+              to use for secure client authentication. This is useful in
+              certificate key infrastructures that do not use JKS. It may be
+              necessary to extend <emphasis role="bold">javax.net.ssl.X509KeyManager
+              </emphasis> and <emphasis role="bold">javax.net.ssl.X509TrustManager</emphasis>
+              to get the desired behavior from the SSL stack. To configure the
+              ZooKeeper server to use the custom provider for authentication,
+              choose a scheme name for the custom AuthenticationProvider and
+              set the property <emphasis role="bold">zookeeper.authProvider.[scheme]
+              </emphasis> to the fully-qualified class name of the custom
+              implementation. This will load the provider into the ProviderRegistry.
+              Then set this property <emphasis role="bold">
+              zookeeper.ssl.authProvider=[scheme]</emphasis> and that provider
+              will be used for secure authentication.</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </section>
+
+      <section>
+        <title>Experimental Options/Features</title>
+
+        <para>New features that are currently considered experimental.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>Read Only Mode Server</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">readonlymode.enabled</emphasis>)</para>
+
+              <para><emphasis role="bold">New in 3.4.0:</emphasis>
+              Setting this value to true enables Read Only Mode server
+              support (disabled by default). ROM allows clients
+              sessions which requested ROM support to connect to the
+              server even when the server might be partitioned from
+              the quorum. In this mode ROM clients can still read
+              values from the ZK service, but will be unable to write
+              values and see changes from other clients. See
+              ZOOKEEPER-784 for more details.
+              </para>
+            </listitem>
+          </varlistentry>
+
+        </variablelist>
+      </section>
+
+      <section>
+        <title>Unsafe Options</title>
+
+        <para>The following options can be useful, but be careful when you use
+        them. The risk of each is explained along with the explanation of what
+        the variable does.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>forceSync</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.forceSync</emphasis>)</para>
+
+              <para>Requires updates to be synced to media of the transaction
+              log before finishing processing the update. If this option is
+              set to no, ZooKeeper will not require updates to be synced to
+              the media.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>jute.maxbuffer:</term>
+
+            <listitem>
+              <para>(Java system property:<emphasis role="bold">
+              jute.maxbuffer</emphasis>)</para>
+
+              <para>This option can only be set as a Java system property.
+              There is no zookeeper prefix on it. It specifies the maximum
+              size of the data that can be stored in a znode. The default is
+              0xfffff, or just under 1M. If this option is changed, the system
+              property must be set on all servers and clients otherwise
+              problems will arise. This is really a sanity check. ZooKeeper is
+              designed to store data on the order of kilobytes in size.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>skipACL</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.skipACL</emphasis>)</para>
+
+              <para>Skips ACL checks. This results in a boost in throughput,
+              but opens up full access to the data tree to everyone.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>quorumListenOnAllIPs</term>
+
+            <listitem>
+              <para>When set to true the ZooKeeper server will listen  
+              for connections from its peers on all available IP addresses,
+              and not only the address configured in the server list of the
+              configuration file. It affects the connections handling the 
+              ZAB protocol and the Fast Leader Election protocol. Default
+              value is <emphasis role="bold">false</emphasis>.</para>
+            </listitem>
+          </varlistentry>
+
+        </variablelist>
+      </section>
+
+      <section>
+        <title>Disabling data directory autocreation</title>
+
+        <para><emphasis role="bold">New in 3.5:</emphasis> The default
+        behavior of a ZooKeeper server is to automatically create the
+        data directory (specified in the configuration file) when
+        started if that directory does not already exist. This can be
+        inconvenient and even dangerous in some cases. Take the case
+        where a configuration change is made to a running server,
+        wherein the <emphasis role="bold">dataDir</emphasis> parameter
+        is accidentally changed. When the ZooKeeper server is
+        restarted it will create this non-existent directory and begin
+        serving - with an empty znode namespace. This scenario can
+        result in an effective "split brain" situation (i.e. data in
+        both the new invalid directory and the original valid data
+        store). As such is would be good to have an option to turn off
+        this autocreate behavior. In general for production
+        environments this should be done, unfortunately however the
+        default legacy behavior cannot be changed at this point and
+        therefore this must be done on a case by case basis. This is
+        left to users and to packagers of ZooKeeper distributions.
+        </para>
+
+        <para>When running <emphasis
+        role="bold">zkServer.sh</emphasis> autocreate can be disabled
+        by setting the environment variable <emphasis
+        role="bold">ZOO_DATADIR_AUTOCREATE_DISABLE</emphasis> to 1.
+        When running ZooKeeper servers directly from class files this
+        can be accomplished by setting <emphasis
+        role="bold">zookeeper.datadir.autocreate=false</emphasis> on
+        the java command line, i.e. <emphasis
+        role="bold">-Dzookeeper.datadir.autocreate=false</emphasis>
+        </para>
+
+        <para>When this feature is disabled, and the ZooKeeper server
+        determines that the required directories do not exist it will
+        generate an error and refuse to start.
+        </para>
+
+        <para>A new script <emphasis
+        role="bold">zkServer-initialize.sh</emphasis> is provided to
+        support this new feature. If autocreate is disabled it is
+        necessary for the user to first install ZooKeeper, then create
+        the data directory (and potentially txnlog directory), and
+        then start the server. Otherwise as mentioned in the previous
+        paragraph the server will not start. Running <emphasis
+        role="bold">zkServer-initialize.sh</emphasis> will create the
+        required directories, and optionally setup the myid file
+        (optional command line parameter). This script can be used
+        even if the autocreate feature itself is not used, and will
+        likely be of use to users as this (setup, including creation
+        of the myid file) has been an issue for users in the past.
+        Note that this script ensures the data directories exist only,
+        it does not create a config file, but rather requires a config
+        file to be available in order to execute.
+        </para>
+      </section>
+
+      <section id="sc_db_existence_validation">
+        <title>Enabling db existence validation</title>
+
+        <para><emphasis role="bold">New in 3.6.0:</emphasis> The default
+          behavior of a ZooKeeper server on startup when no data tree
+          is found is to set zxid to zero and join the quorum as a
+          voting member. This can be dangerous if some event (e.g. a
+          rogue 'rm -rf') has removed the data directory while the
+          server was down since this server may help elect a leader
+          that is missing transactions. Enabling db existence validation
+          will change the behavior on startup when no data tree is
+          found: the server joins the ensemble as a non-voting participant
+          until it is able to sync with the leader and acquire an up-to-date
+          version of the ensemble data. To indicate an empty data tree is
+          expected (ensemble creation), the user should place a file
+          'initialize' in the same directory as 'myid'. This file will
+          be detected and deleted by the server on startup.
+        </para>
+
+        <para> Initialization validation can be enabled when running
+          ZooKeeper servers directly from class files by setting
+          <emphasis role="bold">zookeeper.db.autocreate=false</emphasis>
+          on the java command line, i.e.
+          <emphasis role="bold">-Dzookeeper.db.autocreate=false</emphasis>.
+          Running <emphasis role="bold">zkServer-initialize.sh</emphasis>
+          will create the required initialization file.
+        </para>
+      </section>
+
+      <section id="sc_performance_options">
+        <title>Performance Tuning Options</title>
+
+        <para><emphasis role="bold">New in 3.5.0:</emphasis> Several subsystems have been reworked
+        to improve read throughput. This includes multi-threading of the NIO communication subsystem and
+        request processing pipeline (Commit Processor). NIO is the default client/server communication
+        subsystem. Its threading model comprises 1 acceptor thread, 1-N selector threads and 0-M
+        socket I/O worker threads. In the request processing pipeline the system can be configured
+        to process multiple read request at once while maintaining the same consistency guarantee
+        (same-session read-after-write). The Commit Processor threading model comprises 1 main
+        thread and 0-N worker threads.
+        </para>
+
+        <para>
+        The default values are aimed at maximizing read throughput on a dedicated ZooKeeper machine.
+        Both subsystems need to have sufficient amount of threads to achieve peak read throughput.
+        </para>
+
+        <variablelist>
+
+          <varlistentry>
+            <term>zookeeper.nio.numSelectorThreads</term>
+            <listitem>
+              <para>(Java system property only: <emphasis
+              role="bold">zookeeper.nio.numSelectorThreads</emphasis>)
+              </para>
+              <para><emphasis role="bold">New in 3.5.0:</emphasis>
+              Number of NIO selector threads. At least 1 selector thread required.
+              It is recommended to use more than one selector for large numbers
+              of client connections. The default value is sqrt( number of cpu cores / 2 ).
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>zookeeper.nio.numWorkerThreads</term>
+            <listitem>
+              <para>(Java system property only: <emphasis
+              role="bold">zookeeper.nio.numWorkerThreads</emphasis>)
+              </para>
+              <para><emphasis role="bold">New in 3.5.0:</emphasis>
+              Number of NIO worker threads. If configured with 0 worker threads, the selector threads
+              do the socket I/O directly. The default value is 2 times the number of cpu cores.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>zookeeper.commitProcessor.numWorkerThreads</term>
+            <listitem>
+              <para>(Java system property only: <emphasis
+              role="bold">zookeeper.commitProcessor.numWorkerThreads</emphasis>)
+              </para>
+              <para><emphasis role="bold">New in 3.5.0:</emphasis>
+              Number of Commit Processor worker threads. If configured with 0 worker threads, the main thread
+              will process the request directly. The default value is the number of cpu cores.
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>znode.container.checkIntervalMs</term>
+
+            <listitem>
+              <para>(Java system property only)</para>
+
+              <para><emphasis role="bold">New in 3.6.0:</emphasis> The
+                time interval in milliseconds for each check of candidate container
+                and ttl nodes. Default is "60000".</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>znode.container.maxPerMinute</term>
+
+            <listitem>
+              <para>(Java system property only)</para>
+
+              <para><emphasis role="bold">New in 3.6.0:</emphasis> The
+                maximum number of container and ttl nodes that can be deleted per
+                minute. This prevents herding during container deletion.
+                Default is "10000".</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </section>
+
+      <section>
+        <title>Communication using the Netty framework</title>
+
+        <para><ulink url="http://netty.io">Netty</ulink>
+            is an NIO based client/server communication framework, it
+            simplifies (over NIO being used directly) many of the
+            complexities of network level communication for java
+            applications. Additionally the Netty framework has built
+            in support for encryption (SSL) and authentication
+            (certificates). These are optional features and can be
+            turned on or off individually.
+        </para>
+        <para>In versions 3.5+, a ZooKeeper server can use Netty
+            instead of NIO (default option) by setting the environment
+            variable <emphasis role="bold">zookeeper.serverCnxnFactory</emphasis>
+            to <emphasis role="bold">org.apache.zookeeper.server.NettyServerCnxnFactory</emphasis>;
+            for the client, set <emphasis role="bold">zookeeper.clientCnxnSocket</emphasis>
+            to <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>.
+        </para>
+
+        <para>
+          TBD - tuning options for netty - currently there are none that are netty specific but we should add some. Esp around max bound on the number of reader worker threads netty creates.
+        </para>
+        <para>
+          TBD - how to manage encryption
+        </para>
+        <para>
+          TBD - how to manage certificates
+        </para>
+
+      </section>
+
+      <section id="sc_adminserver_config">
+        <title>AdminServer configuration</title>
+        <para><emphasis role="bold">New in 3.5.0:</emphasis> The following
+        options are used to configure the <ulink
+        url="#sc_adminserver">AdminServer</ulink>.</para>
+
+        <variablelist>
+          <varlistentry>
+            <term>admin.enableServer</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.admin.enableServer</emphasis>)</para>
+
+              <para>Set to "false" to disable the AdminServer.  By default the
+              AdminServer is enabled.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>admin.serverAddress</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.admin.serverAddress</emphasis>)</para>
+
+              <para>The address the embedded Jetty server listens on. Defaults to 0.0.0.0.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>admin.serverPort</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.admin.serverPort</emphasis>)</para>
+
+              <para>The port the embedded Jetty server listens on.  Defaults to 8080.</para>
+            </listitem>
+          </varlistentry>
+
+            <varlistentry>
+                <term>admin.idleTimeout</term>
+
+                <listitem>
+                    <para>(Java system property: <emphasis
+                            role="bold">zookeeper.admin.idleTimeout</emphasis>)</para>
+
+                    <para>Set the maximum idle time in milliseconds that a connection can wait 
+                          before sending or receiving data. Defaults to 30000 ms.</para>
+                </listitem>
+            </varlistentry>
+
+
+          <varlistentry>
+            <term>admin.commandURL</term>
+
+            <listitem>
+              <para>(Java system property: <emphasis
+              role="bold">zookeeper.admin.commandURL</emphasis>)</para>
+
+              <para>The URL for listing and issuing commands relative to the
+              root URL.  Defaults to "/commands".</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </section>
+
+    </section>
+
+    <section id="sc_zkCommands">
+      <title>ZooKeeper Commands</title>
+
+      <section id="sc_4lw">
+        <title>The Four Letter Words</title>
+        <para>ZooKeeper responds to a small set of commands. Each command is
+        composed of four letters. You issue the commands to ZooKeeper via telnet
+        or nc, at the client port.</para>
+
+        <para>Three of the more interesting commands: "stat" gives some
+        general information about the server and connected clients,
+        while "srvr" and "cons" give extended details on server and
+        connections respectively.</para>
+
+        <para><emphasis role="bold">New in 3.5.3:</emphasis>
+          Four Letter Words need to be explicitly white listed before using.
+          Please refer <emphasis role="bold">4lw.commands.whitelist</emphasis>
+           described in <ulink url="#sc_clusterOptions">
+            cluster configuration section</ulink> for details.
+          Moving forward, Four Letter Words will be deprecated, please use
+          <ulink url="#sc_adminserver">AdminServer</ulink> instead.
+        </para>
+
+      <variablelist>
+          <varlistentry>
+            <term>conf</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Print
+              details about serving configuration.</para>
+            </listitem>
+
+          </varlistentry>
+
+          <varlistentry>
+            <term>cons</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> List
+              full connection/session details for all clients connected
+              to this server. Includes information on numbers of packets
+              received/sent, session id, operation latencies, last
+              operation performed, etc...</para>
+            </listitem>
+
+          </varlistentry>
+
+          <varlistentry>
+            <term>crst</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Reset
+              connection/session statistics for all connections.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>dump</term>
+
+            <listitem>
+              <para>Lists the outstanding sessions and ephemeral nodes. This
+              only works on the leader.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>envi</term>
+
+            <listitem>
+              <para>Print details about serving environment</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>ruok</term>
+
+            <listitem>
+              <para>Tests if server is running in a non-error state. The server
+              will respond with imok if it is running. Otherwise it will not
+              respond at all.</para>
+
+              <para>A response of "imok" does not necessarily indicate that the
+              server has joined the quorum, just that the server process is active
+              and bound to the specified client port. Use "stat" for details on
+              state wrt quorum and client connection information.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>srst</term>
+
+            <listitem>
+              <para>Reset server statistics.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>srvr</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
+              full details for the server.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>stat</term>
+
+            <listitem>
+              <para>Lists brief details for the server and connected
+              clients.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>wchs</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
+              brief information on watches for the server.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>wchc</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
+              detailed information on watches for the server, by
+              session.  This outputs a list of sessions(connections)
+              with associated watches (paths). Note, depending on the
+              number of watches this operation may be expensive (ie
+              impact server performance), use it carefully.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>dirs</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.5.1:</emphasis>
+                Shows the total size of snapshot and log files in bytes
+              </para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>wchp</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
+              detailed information on watches for the server, by path.
+              This outputs a list of paths (znodes) with associated
+              sessions. Note, depending on the number of watches this
+              operation may be expensive (ie impact server performance),
+              use it carefully.</para>
+            </listitem>
+          </varlistentry>
+
+
+          <varlistentry>
+            <term>mntr</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.4.0:</emphasis> Outputs a list 
+              of variables that could be used for monitoring the health of the cluster.</para>
+
+              <programlisting>$ echo mntr | nc localhost 2185
+
+              zk_version  3.4.0
+              zk_avg_latency  0
+              zk_max_latency  0
+              zk_min_latency  0
+              zk_packets_received 70
+              zk_packets_sent 69
+              zk_num_alive_connections	1
+              zk_outstanding_requests 0
+              zk_server_state leader
+              zk_znode_count   4
+              zk_watch_count  0
+              zk_ephemerals_count 0
+              zk_approximate_data_size    27
+              zk_followers    4                   - only exposed by the Leader
+              zk_synced_followers 4               - only exposed by the Leader
+              zk_pending_syncs    0               - only exposed by the Leader
+              zk_open_file_descriptor_count 23    - only available on Unix platforms
+              zk_max_file_descriptor_count 1024   - only available on Unix platforms
+              </programlisting>
+
+              <para>The output is compatible with java properties format and the content 
+              may change over time (new keys added). Your scripts should expect changes.</para>
+
+              <para>ATTENTION: Some of the keys are platform specific and some of the keys are only exported by the Leader. </para>
+
+              <para>The output contains multiple lines with the following format:</para>
+              <programlisting>key \t value</programlisting>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>isro</term>
+
+            <listitem>
+              <para><emphasis role="bold">New in 3.4.0:</emphasis> Tests if
+              server is running in read-only mode.  The server will respond with
+              "ro" if in read-only mode or "rw" if not in read-only mode.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>gtmk</term>
+
+            <listitem>
+              <para>Gets the current trace mask as a 64-bit signed long value in
+              decimal format.  See <command>stmk</command> for an explanation of
+              the possible values.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term>stmk</term>
+
+            <listitem>
+              <para>Sets the current trace mask.  The trace mask is 64 bits,
+              where each bit enables or disables a specific category of trace
+              logging on the server.  Log4J must be configured to enable
+              <command>TRACE</command> level first in order to see trace logging
+              messages.  The bits of the trace mask correspond to the following
+              trace logging categories.</para>
+
+              <table>
+                <title>Trace Mask Bit Values</title>
+                <tgroup cols="2" align="left" colsep="1" rowsep="1">
+                  <tbody>
+                    <row>
+                      <entry>0b0000000000</entry>
+                      <entry>Unused, reserved for future use.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0000000010</entry>
+                      <entry>Logs client requests, excluding ping
+                      requests.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0000000100</entry>
+                      <entry>Unused, reserved for future use.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0000001000</entry>
+                      <entry>Logs client ping requests.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0000010000</entry>
+                      <entry>Logs packets received from the quorum peer that is
+                      the current leader, excluding ping requests.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0000100000</entry>
+                      <entry>Logs addition, removal and validation of client
+                      sessions.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0001000000</entry>
+                      <entry>Logs delivery of watch events to client
+                      sessions.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0010000000</entry>
+                      <entry>Logs ping packets received from the quorum peer
+                      that is the current leader.</entry>
+                    </row>
+                    <row>
+                      <entry>0b0100000000</entry>
+                      <entry>Unused, reserved for future use.</entry>
+                    </row>
+                  

<TRUNCATED>

[07/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml b/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
deleted file mode 100644
index e320ed6..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
+++ /dev/null
@@ -1,712 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="ar_Tutorial">
-  <title>Programming with ZooKeeper - A basic tutorial</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This article contains sample Java code for simple implementations of barrier
-      and consumers queues..</para>
-
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_Introduction">
-    <title>Introduction</title>
-
-    <para>In this tutorial, we show simple implementations of barriers and 
-    producer-consumer queues using ZooKeeper. We call the respective classes Barrier and Queue. 
-    These examples assume that you have at least one ZooKeeper server running.</para>
-    
-    <para>Both primitives use the following common excerpt of code:</para>
-    
-    <programlisting>
-    static ZooKeeper zk = null;
-    static Integer mutex;
-
-    String root;
-
-    SyncPrimitive(String address) {
-        if(zk == null){
-            try {
-                System.out.println("Starting ZK:");
-                zk = new ZooKeeper(address, 3000, this);
-                mutex = new Integer(-1);
-                System.out.println("Finished starting ZK: " + zk);
-            } catch (IOException e) {
-                System.out.println(e.toString());
-                zk = null;
-            }
-        }
-    }
-
-    synchronized public void process(WatchedEvent event) {
-        synchronized (mutex) {
-            mutex.notify();
-        }
-    }
-</programlisting>
-
-<para>Both classes extend SyncPrimitive. In this way, we execute steps that are 
-common to all primitives in the constructor of SyncPrimitive. To keep the examples 
-simple, we create a ZooKeeper object the first time we instantiate either a barrier 
-object or a queue object, and we declare a static variable that is a reference 
-to this object. The subsequent instances of Barrier and Queue check whether a 
-ZooKeeper object exists. Alternatively, we could have the application creating a
-ZooKeeper object and passing it to the constructor of Barrier and Queue.</para>
-<para>
-We use the process() method to process notifications triggered due to watches. 
-In the following discussion, we present code that sets watches. A watch is internal 
-structure that enables ZooKeeper to notify a client of a change to a node. For example, 
-if a client is waiting for other clients to leave a barrier, then it can set a watch and 
-wait for modifications to a particular node, which can indicate that it is the end of the wait. 
-This point becomes clear once we go over the examples.
-</para>
-</section>
-   
- <section id="sc_barriers"><title>Barriers</title>
- 
- <para>
- A barrier is a primitive that enables a group of processes to synchronize the 
- beginning and the end of a computation. The general idea of this implementation 
- is to have a barrier node that serves the purpose of being a parent for individual 
- process nodes. Suppose that we call the barrier node "/b1". Each process "p" then 
- creates a node "/b1/p". Once enough processes have created their corresponding 
- nodes, joined processes can start the computation.
- </para>
- 
- <para>In this example, each process instantiates a Barrier object, and its constructor takes as parameters:</para>
-
- <itemizedlist><listitem><para>the address of a ZooKeeper server (e.g., "zoo1.foo.com:2181")</para></listitem>
-<listitem><para>the path of the barrier node on ZooKeeper (e.g., "/b1")</para></listitem>
-<listitem><para>the size of the group of processes</para></listitem>
-</itemizedlist>
-
-<para>The constructor of Barrier passes the address of the Zookeeper server to the 
-constructor of the parent class. The parent class creates a ZooKeeper instance if 
-one does not exist. The constructor of Barrier then creates a 
-barrier node on ZooKeeper, which is the parent node of all process nodes, and 
-we call root (<emphasis role="bold">Note:</emphasis> This is not the ZooKeeper root "/").</para>
-
-<programlisting>
-        /**
-         * Barrier constructor
-         *
-         * @param address
-         * @param root
-         * @param size
-         */
-        Barrier(String address, String root, int size) {
-            super(address);
-            this.root = root;
-            this.size = size;
-
-            // Create barrier node
-            if (zk != null) {
-                try {
-                    Stat s = zk.exists(root, false);
-                    if (s == null) {
-                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                                CreateMode.PERSISTENT);
-                    }
-                } catch (KeeperException e) {
-                    System.out
-                            .println("Keeper exception when instantiating queue: "
-                                    + e.toString());
-                } catch (InterruptedException e) {
-                    System.out.println("Interrupted exception");
-                }
-            }
-
-            // My node name
-            try {
-                name = new String(InetAddress.getLocalHost().getCanonicalHostName().toString());
-            } catch (UnknownHostException e) {
-                System.out.println(e.toString());
-            }
-
-        }
-</programlisting>
-<para>
-To enter the barrier, a process calls enter(). The process creates a node under 
-the root to represent it, using its host name to form the node name. It then wait 
-until enough processes have entered the barrier. A process does it by checking 
-the number of children the root node has with "getChildren()", and waiting for 
-notifications in the case it does not have enough. To receive a notification when 
-there is a change to the root node, a process has to set a watch, and does it 
-through the call to "getChildren()". In the code, we have that "getChildren()" 
-has two parameters. The first one states the node to read from, and the second is
-a boolean flag that enables the process to set a watch. In the code the flag is true.
-</para>
-
-<programlisting>
-        /**
-         * Join barrier
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-
-        boolean enter() throws KeeperException, InterruptedException{
-            zk.create(root + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                    CreateMode.EPHEMERAL_SEQUENTIAL);
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-
-                    if (list.size() &lt; size) {
-                        mutex.wait();
-                    } else {
-                        return true;
-                    }
-                }
-            }
-        }
-</programlisting>
-<para>
-Note that enter() throws both KeeperException and InterruptedException, so it is 
-the responsibility of the application to catch and handle such exceptions.</para>
-
-<para>
-Once the computation is finished, a process calls leave() to leave the barrier. 
-First it deletes its corresponding node, and then it gets the children of the root 
-node. If there is at least one child, then it waits for a notification (obs: note 
-that the second parameter of the call to getChildren() is true, meaning that 
-ZooKeeper has to set a watch on the the root node). Upon reception of a notification, 
-it checks once more whether the root node has any children.</para>
-
-<programlisting>
-        /**
-         * Wait until all reach barrier
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-
-        boolean leave() throws KeeperException, InterruptedException{
-            zk.delete(root + "/" + name, 0);
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-                        if (list.size() &gt; 0) {
-                            mutex.wait();
-                        } else {
-                            return true;
-                        }
-                    }
-                }
-        }
-    }
-</programlisting>
-</section>
-<section id="sc_producerConsumerQueues"><title>Producer-Consumer Queues</title>
-<para>
-A producer-consumer queue is a distributed data structure that groups of processes 
-use to generate and consume items. Producer processes create new elements and add 
-them to the queue. Consumer processes remove elements from the list, and process them. 
-In this implementation, the elements are simple integers. The queue is represented 
-by a root node, and to add an element to the queue, a producer process creates a new node, 
-a child of the root node.
-</para>
-
-<para>
-The following excerpt of code corresponds to the constructor of the object. As 
-with Barrier objects, it first calls the constructor of the parent class, SyncPrimitive, 
-that creates a ZooKeeper object if one doesn't exist. It then verifies if the root 
-node of the queue exists, and creates if it doesn't.
-</para>
-<programlisting>
-        /**
-         * Constructor of producer-consumer queue
-         *
-         * @param address
-         * @param name
-         */
-        Queue(String address, String name) {
-            super(address);
-            this.root = name;
-            // Create ZK node name
-            if (zk != null) {
-                try {
-                    Stat s = zk.exists(root, false);
-                    if (s == null) {
-                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                                CreateMode.PERSISTENT);
-                    }
-                } catch (KeeperException e) {
-                    System.out
-                            .println("Keeper exception when instantiating queue: "
-                                    + e.toString());
-                } catch (InterruptedException e) {
-                    System.out.println("Interrupted exception");
-                }
-            }
-        }
-</programlisting>
- 
-<para>
-A producer process calls "produce()" to add an element to the queue, and passes 
-an integer as an argument. To add an element to the queue, the method creates a 
-new node using "create()", and uses the SEQUENCE flag to instruct ZooKeeper to 
-append the value of the sequencer counter associated to the root node. In this way, 
-we impose a total order on the elements of the queue, thus guaranteeing that the 
-oldest element of the queue is the next one consumed.
-</para>
-
-<programlisting>
-        /**
-         * Add element to the queue.
-         *
-         * @param i
-         * @return
-         */
-
-        boolean produce(int i) throws KeeperException, InterruptedException{
-            ByteBuffer b = ByteBuffer.allocate(4);
-            byte[] value;
-
-            // Add child with value i
-            b.putInt(i);
-            value = b.array();
-            zk.create(root + "/element", value, Ids.OPEN_ACL_UNSAFE,
-                        CreateMode.PERSISTENT_SEQUENTIAL);
-
-            return true;
-        }
-</programlisting>
-<para>
-To consume an element, a consumer process obtains the children of the root node, 
-reads the node with smallest counter value, and returns the element. Note that 
-if there is a conflict, then one of the two contending processes won't be able to 
-delete the node and the delete operation will throw an exception.</para>
-
-<para>
-A call to getChildren() returns the list of children in lexicographic order. 
-As lexicographic order does not necessary follow the numerical order of the counter 
-values, we need to decide which element is the smallest. To decide which one has 
-the smallest counter value, we traverse the list, and remove the prefix "element" 
-from each one.</para>
-
-<programlisting>
-        /**
-         * Remove first element from the queue.
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-        int consume() throws KeeperException, InterruptedException{
-            int retvalue = -1;
-            Stat stat = null;
-
-            // Get the first element available
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-                    if (list.size() == 0) {
-                        System.out.println("Going to wait");
-                        mutex.wait();
-                    } else {
-                        Integer min = new Integer(list.get(0).substring(7));
-                        for(String s : list){
-                            Integer tempValue = new Integer(s.substring(7));
-                            //System.out.println("Temporary value: " + tempValue);
-                            if(tempValue &lt; min) min = tempValue;
-                        }
-                        System.out.println("Temporary value: " + root + "/element" + min);
-                        byte[] b = zk.getData(root + "/element" + min,
-                                    false, stat);
-                        zk.delete(root + "/element" + min, 0);
-                        ByteBuffer buffer = ByteBuffer.wrap(b);
-                        retvalue = buffer.getInt();
-
-                        return retvalue;
-                    }
-                }
-            }
-        }
-    }
-</programlisting>
- 
-</section>
-
-<section>
-<title>Complete example</title>
-<para>
-In the following section you can find a complete command line application to demonstrate the above mentioned
-recipes. Use the following command to run it.
-</para>
-<programlisting>
-ZOOBINDIR="[path_to_distro]/bin"
-. "$ZOOBINDIR"/zkEnv.sh
-java SyncPrimitive [Test Type] [ZK server] [No of elements] [Client type]
-</programlisting>
-
-<section>
-<title>Queue test</title>
-<para>Start a producer to create 100 elements</para>
-<programlisting>
-java SyncPrimitive qTest localhost 100 p
-</programlisting>
-
-<para>Start a consumer to consume 100 elements</para>
-<programlisting>
-java SyncPrimitive qTest localhost 100 c
-</programlisting>
-</section>
-
-<section>
-<title>Barrier test</title>
-<para>Start a barrier with 2 participants (start as many times as many participants you'd like to enter)</para>
-<programlisting>
-java SyncPrimitive bTest localhost 2
-</programlisting>
-</section>
-
-<section id="sc_sourceListing"><title>Source Listing</title>
-<example id="eg_SyncPrimitive_java">
-<title>SyncPrimitive.Java</title>
-<programlisting>
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.Stat;
-
-public class SyncPrimitive implements Watcher {
-
-    static ZooKeeper zk = null;
-    static Integer mutex;
-
-    String root;
-
-    SyncPrimitive(String address) {
-        if(zk == null){
-            try {
-                System.out.println("Starting ZK:");
-                zk = new ZooKeeper(address, 3000, this);
-                mutex = new Integer(-1);
-                System.out.println("Finished starting ZK: " + zk);
-            } catch (IOException e) {
-                System.out.println(e.toString());
-                zk = null;
-            }
-        }
-        //else mutex = new Integer(-1);
-    }
-
-    synchronized public void process(WatchedEvent event) {
-        synchronized (mutex) {
-            //System.out.println("Process: " + event.getType());
-            mutex.notify();
-        }
-    }
-
-    /**
-     * Barrier
-     */
-    static public class Barrier extends SyncPrimitive {
-        int size;
-        String name;
-
-        /**
-         * Barrier constructor
-         *
-         * @param address
-         * @param root
-         * @param size
-         */
-        Barrier(String address, String root, int size) {
-            super(address);
-            this.root = root;
-            this.size = size;
-
-            // Create barrier node
-            if (zk != null) {
-                try {
-                    Stat s = zk.exists(root, false);
-                    if (s == null) {
-                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                                CreateMode.PERSISTENT);
-                    }
-                } catch (KeeperException e) {
-                    System.out
-                            .println("Keeper exception when instantiating queue: "
-                                    + e.toString());
-                } catch (InterruptedException e) {
-                    System.out.println("Interrupted exception");
-                }
-            }
-
-            // My node name
-            try {
-                name = new String(InetAddress.getLocalHost().getCanonicalHostName().toString());
-            } catch (UnknownHostException e) {
-                System.out.println(e.toString());
-            }
-
-        }
-
-        /**
-         * Join barrier
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-
-        boolean enter() throws KeeperException, InterruptedException{
-            zk.create(root + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                    CreateMode.EPHEMERAL_SEQUENTIAL);
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-
-                    if (list.size() &lt; size) {
-                        mutex.wait();
-                    } else {
-                        return true;
-                    }
-                }
-            }
-        }
-
-        /**
-         * Wait until all reach barrier
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-
-        boolean leave() throws KeeperException, InterruptedException{
-            zk.delete(root + "/" + name, 0);
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-                        if (list.size() &gt; 0) {
-                            mutex.wait();
-                        } else {
-                            return true;
-                        }
-                    }
-                }
-        }
-    }
-
-    /**
-     * Producer-Consumer queue
-     */
-    static public class Queue extends SyncPrimitive {
-
-        /**
-         * Constructor of producer-consumer queue
-         *
-         * @param address
-         * @param name
-         */
-        Queue(String address, String name) {
-            super(address);
-            this.root = name;
-            // Create ZK node name
-            if (zk != null) {
-                try {
-                    Stat s = zk.exists(root, false);
-                    if (s == null) {
-                        zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                                CreateMode.PERSISTENT);
-                    }
-                } catch (KeeperException e) {
-                    System.out
-                            .println("Keeper exception when instantiating queue: "
-                                    + e.toString());
-                } catch (InterruptedException e) {
-                    System.out.println("Interrupted exception");
-                }
-            }
-        }
-
-        /**
-         * Add element to the queue.
-         *
-         * @param i
-         * @return
-         */
-
-        boolean produce(int i) throws KeeperException, InterruptedException{
-            ByteBuffer b = ByteBuffer.allocate(4);
-            byte[] value;
-
-            // Add child with value i
-            b.putInt(i);
-            value = b.array();
-            zk.create(root + "/element", value, Ids.OPEN_ACL_UNSAFE,
-                        CreateMode.PERSISTENT_SEQUENTIAL);
-
-            return true;
-        }
-
-
-        /**
-         * Remove first element from the queue.
-         *
-         * @return
-         * @throws KeeperException
-         * @throws InterruptedException
-         */
-        int consume() throws KeeperException, InterruptedException{
-            int retvalue = -1;
-            Stat stat = null;
-
-            // Get the first element available
-            while (true) {
-                synchronized (mutex) {
-                    List&lt;String&gt; list = zk.getChildren(root, true);
-                    if (list.size() == 0) {
-                        System.out.println("Going to wait");
-                        mutex.wait();
-                    } else {
-                        Integer min = new Integer(list.get(0).substring(7));
-                        String minNode = list.get(0);
-                        for(String s : list){
-                            Integer tempValue = new Integer(s.substring(7));
-                            //System.out.println("Temporary value: " + tempValue);
-                            if(tempValue &lt; min) {
-                                min = tempValue;
-                                minNode = s;
-                            }
-                        }
-                        System.out.println("Temporary value: " + root + "/" + minNode);
-                        byte[] b = zk.getData(root + "/" + minNode,
-                        false, stat);
-                        zk.delete(root + "/" + minNode, 0);
-                        ByteBuffer buffer = ByteBuffer.wrap(b);
-                        retvalue = buffer.getInt();
-
-                        return retvalue;
-                    }
-                }
-            }
-        }
-    }
-
-    public static void main(String args[]) {
-        if (args[0].equals("qTest"))
-            queueTest(args);
-        else
-            barrierTest(args);
-
-    }
-
-    public static void queueTest(String args[]) {
-        Queue q = new Queue(args[1], "/app1");
-
-        System.out.println("Input: " + args[1]);
-        int i;
-        Integer max = new Integer(args[2]);
-
-        if (args[3].equals("p")) {
-            System.out.println("Producer");
-            for (i = 0; i &lt; max; i++)
-                try{
-                    q.produce(10 + i);
-                } catch (KeeperException e){
-
-                } catch (InterruptedException e){
-
-                }
-        } else {
-            System.out.println("Consumer");
-
-            for (i = 0; i &lt; max; i++) {
-                try{
-                    int r = q.consume();
-                    System.out.println("Item: " + r);
-                } catch (KeeperException e){
-                    i--;
-                } catch (InterruptedException e){
-
-                }
-            }
-        }
-    }
-
-    public static void barrierTest(String args[]) {
-        Barrier b = new Barrier(args[1], "/b1", new Integer(args[2]));
-        try{
-            boolean flag = b.enter();
-            System.out.println("Entered barrier: " + args[2]);
-            if(!flag) System.out.println("Error when entering the barrier");
-        } catch (KeeperException e){
-
-        } catch (InterruptedException e){
-
-        }
-
-        // Generate random integer
-        Random rand = new Random();
-        int r = rand.nextInt(100);
-        // Loop for rand iterations
-        for (int i = 0; i &lt; r; i++) {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-
-            }
-        }
-        try{
-            b.leave();
-        } catch (KeeperException e){
-
-        } catch (InterruptedException e){
-
-        }
-        System.out.println("Left barrier");
-    }
-}
-</programlisting></example>
-</section>
-</section>
-
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/2pc.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/2pc.jpg b/src/docs/src/documentation/resources/images/2pc.jpg
deleted file mode 100755
index fe4488f..0000000
Binary files a/src/docs/src/documentation/resources/images/2pc.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/bk-overview.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/bk-overview.jpg b/src/docs/src/documentation/resources/images/bk-overview.jpg
deleted file mode 100644
index 6e12fb4..0000000
Binary files a/src/docs/src/documentation/resources/images/bk-overview.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/favicon.ico
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/favicon.ico b/src/docs/src/documentation/resources/images/favicon.ico
deleted file mode 100644
index 161bcf7..0000000
Binary files a/src/docs/src/documentation/resources/images/favicon.ico and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/hadoop-logo.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/hadoop-logo.jpg b/src/docs/src/documentation/resources/images/hadoop-logo.jpg
deleted file mode 100644
index 809525d..0000000
Binary files a/src/docs/src/documentation/resources/images/hadoop-logo.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/state_dia.dia
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/state_dia.dia b/src/docs/src/documentation/resources/images/state_dia.dia
deleted file mode 100755
index 4a58a00..0000000
Binary files a/src/docs/src/documentation/resources/images/state_dia.dia and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/state_dia.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/state_dia.jpg b/src/docs/src/documentation/resources/images/state_dia.jpg
deleted file mode 100755
index b6f4a8b..0000000
Binary files a/src/docs/src/documentation/resources/images/state_dia.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkarch.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkarch.jpg b/src/docs/src/documentation/resources/images/zkarch.jpg
deleted file mode 100644
index a0e5fcc..0000000
Binary files a/src/docs/src/documentation/resources/images/zkarch.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkcomponents.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkcomponents.jpg b/src/docs/src/documentation/resources/images/zkcomponents.jpg
deleted file mode 100644
index 7690578..0000000
Binary files a/src/docs/src/documentation/resources/images/zkcomponents.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zknamespace.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zknamespace.jpg b/src/docs/src/documentation/resources/images/zknamespace.jpg
deleted file mode 100644
index 05534bc..0000000
Binary files a/src/docs/src/documentation/resources/images/zknamespace.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkperfRW-3.2.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkperfRW-3.2.jpg b/src/docs/src/documentation/resources/images/zkperfRW-3.2.jpg
deleted file mode 100644
index 594b50b..0000000
Binary files a/src/docs/src/documentation/resources/images/zkperfRW-3.2.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkperfRW.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkperfRW.jpg b/src/docs/src/documentation/resources/images/zkperfRW.jpg
deleted file mode 100644
index ad3019f..0000000
Binary files a/src/docs/src/documentation/resources/images/zkperfRW.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkperfreliability.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkperfreliability.jpg b/src/docs/src/documentation/resources/images/zkperfreliability.jpg
deleted file mode 100644
index 232bba8..0000000
Binary files a/src/docs/src/documentation/resources/images/zkperfreliability.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zkservice.jpg
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zkservice.jpg b/src/docs/src/documentation/resources/images/zkservice.jpg
deleted file mode 100644
index 1ec9154..0000000
Binary files a/src/docs/src/documentation/resources/images/zkservice.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/resources/images/zookeeper_small.gif
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/resources/images/zookeeper_small.gif b/src/docs/src/documentation/resources/images/zookeeper_small.gif
deleted file mode 100644
index 4e8014f..0000000
Binary files a/src/docs/src/documentation/resources/images/zookeeper_small.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/skinconf.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/skinconf.xml b/src/docs/src/documentation/skinconf.xml
deleted file mode 100644
index 9edf69e..0000000
--- a/src/docs/src/documentation/skinconf.xml
+++ /dev/null
@@ -1,360 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!--
-Skin configuration file. This file contains details of your project,
-which will be used to configure the chosen Forrest skin.
--->
-
-<!DOCTYPE skinconfig PUBLIC "-//APACHE//DTD Skin Configuration V0.6-3//EN" "http://forrest.apache.org/dtd/skinconfig-v06-3.dtd">
-<skinconfig>
-  <!-- To enable lucene search add provider="lucene" (default is google).
-    Add box-location="alt" to move the search box to an alternate location
-    (if the skin supports it) and box-location="all" to show it in all
-    available locations on the page.  Remove the <search> element to show
-    no search box. @domain will enable sitesearch for the specific domain with google.
-    In other words google will search the @domain for the query string.
-
-  -->
-  <search name="ZooKeeper" domain="zookeeper.apache.org" provider="google"/>
-
-  <!-- Disable the print link? If enabled, invalid HTML 4.0.1 -->
-  <disable-print-link>true</disable-print-link>  
-  <!-- Disable the PDF link? -->
-  <disable-pdf-link>false</disable-pdf-link>
-  <!-- Disable the POD link? -->
-  <disable-pod-link>true</disable-pod-link>
-  <!-- Disable the Text link? FIXME: NOT YET IMPLEMENETED. -->
-  <disable-txt-link>true</disable-txt-link>
-  <!-- Disable the xml source link? -->
-  <!-- The xml source link makes it possible to access the xml rendition
-    of the source frim the html page, and to have it generated statically.
-    This can be used to enable other sites and services to reuse the
-    xml format for their uses. Keep this disabled if you don't want other
-    sites to easily reuse your pages.-->
-  <disable-xml-link>true</disable-xml-link>
-
-  <!-- Disable navigation icons on all external links? -->
-  <disable-external-link-image>true</disable-external-link-image>
-
-  <!-- Disable w3c compliance links? 
-    Use e.g. align="center" to move the compliance links logos to 
-    an alternate location default is left.
-    (if the skin supports it) -->
-  <disable-compliance-links>true</disable-compliance-links>
-
-  <!-- Render mailto: links unrecognisable by spam harvesters? -->
-  <obfuscate-mail-links>false</obfuscate-mail-links>
-
-  <!-- Disable the javascript facility to change the font size -->
-  <disable-font-script>true</disable-font-script>
-
-  <!-- project logo -->
-  <project-name>ZooKeeper</project-name>
-  <project-description>ZooKeeper: distributed coordination</project-description>
-  <project-url>http://zookeeper.apache.org/</project-url>
-  <project-logo>images/zookeeper_small.gif</project-logo>
-
-  <!-- group logo -->
-  <group-name>Hadoop</group-name>
-  <group-description>Apache Hadoop</group-description>
-  <group-url>http://hadoop.apache.org/</group-url>
-  <group-logo>images/hadoop-logo.jpg</group-logo>
-
-  <!-- optional host logo (e.g. sourceforge logo)
-       default skin: renders it at the bottom-left corner -->
-  <host-url></host-url>
-  <host-logo></host-logo>
-
-  <!-- relative url of a favicon file, normally favicon.ico -->
-  <favicon-url>images/favicon.ico</favicon-url>
-
-  <!-- The following are used to construct a copyright statement -->
-  <year></year>
-  <vendor>The Apache Software Foundation.</vendor>
-  <copyright-link>http://www.apache.org/licenses/</copyright-link>
-
-  <!-- Some skins use this to form a 'breadcrumb trail' of links.
-    Use location="alt" to move the trail to an alternate location
-    (if the skin supports it).
-	  Omit the location attribute to display the trail in the default location.
-	  Use location="none" to not display the trail (if the skin supports it).
-    For some skins just set the attributes to blank.
-  -->
-  <trail>
-    <link1 name="Apache" href="http://www.apache.org/"/>
-    <link2 name="ZooKeeper" href="http://zookeeper.apache.org/"/>
-    <link3 name="ZooKeeper" href="http://zookeeper.apache.org/"/>
-  </trail>
-
-  <!-- Configure the TOC, i.e. the Table of Contents.
-  @max-depth
-   how many "section" levels need to be included in the
-   generated Table of Contents (TOC). 
-  @min-sections
-   Minimum required to create a TOC.
-  @location ("page","menu","page,menu", "none")
-   Where to show the TOC.
-  -->
-  <toc max-depth="2" min-sections="1" location="page"/>
-
-  <!-- Heading types can be clean|underlined|boxed  -->
-  <headings type="clean"/>
-  
-  <!-- The optional feedback element will be used to construct a
-    feedback link in the footer with the page pathname appended:
-    <a href="@href">{@to}</a>
-  <feedback to="webmaster@foo.com"
-    href="mailto:webmaster@foo.com?subject=Feedback&#160;" >
-    Send feedback about the website to:
-  </feedback>
-    -->
-  <!--
-    extra-css - here you can define custom css-elements that are 
-    a. overriding the fallback elements or 
-    b. adding the css definition from new elements that you may have 
-       used in your documentation.
-    -->
-  <extra-css>
-    <!--Example of b. 
-        To define the css definition of a new element that you may have used
-        in the class attribute of a <p> node. 
-        e.g. <p class="quote"/>
-    -->
-    p.quote {
-      margin-left: 2em;
-      padding: .5em;
-      background-color: #f0f0f0;
-      font-family: monospace;
-    }
-
-    pre.code {
-      margin-left: 0em;
-      padding: 0.5em;
-      background-color: #f0f0f0;
-      font-family: monospace;
-    }
-
-<!-- patricks
-    .code {
-      font-family: "Courier New", Courier, monospace;
-      font-size: 110%;
-    }
--->
-
-  </extra-css>
-
-  <colors>
-  <!-- These values are used for the generated CSS files. -->
-
-  <!-- Krysalis -->
-<!--
-    <color name="header"    value="#FFFFFF"/>
-
-    <color name="tab-selected" value="#a5b6c6" link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="tab-unselected" value="#F7F7F7"  link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="subtab-selected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="subtab-unselected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
-
-    <color name="heading" value="#a5b6c6"/>
-    <color name="subheading" value="#CFDCED"/>
-        
-    <color name="navstrip" value="#CFDCED" font="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="toolbox" value="#a5b6c6"/>
-    <color name="border" value="#a5b6c6"/>
-        
-    <color name="menu" value="#F7F7F7" link="#000000" vlink="#000000" hlink="#000000"/>    
-    <color name="dialog" value="#F7F7F7"/>
-            
-    <color name="body"    value="#ffffff" link="#0F3660" vlink="#009999" hlink="#000066"/>
-    
-    <color name="table" value="#a5b6c6"/>    
-    <color name="table-cell" value="#ffffff"/>    
-    <color name="highlight" value="#ffff00"/>
-    <color name="fixme" value="#cc6600"/>
-    <color name="note" value="#006699"/>
-    <color name="warning" value="#990000"/>
-    <color name="code" value="#a5b6c6"/>
-        
-    <color name="footer" value="#a5b6c6"/>
--->
-  
-  <!-- Forrest -->
-<!--
-    <color name="header"    value="#294563"/>
-
-    <color name="tab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
-    <color name="tab-unselected" value="#b5c7e7" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
-    <color name="subtab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
-    <color name="subtab-unselected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
-
-    <color name="heading" value="#294563"/>
-    <color name="subheading" value="#4a6d8c"/>
-        
-    <color name="navstrip" value="#cedfef" font="#0F3660" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
-    <color name="toolbox" value="#4a6d8c"/>
-    <color name="border" value="#294563"/>
-    
-    <color name="menu" value="#4a6d8c" font="#cedfef" link="#ffffff" vlink="#ffffff" hlink="#ffcf00"/>    
-    <color name="dialog" value="#4a6d8c"/>
-            
-    <color name="body" value="#ffffff"  link="#0F3660" vlink="#009999" hlink="#000066"/>
-    
-    <color name="table" value="#7099C5"/>    
-    <color name="table-cell" value="#f0f0ff"/>    
-    <color name="highlight" value="#ffff00"/>
-    <color name="fixme" value="#cc6600"/>
-    <color name="note" value="#006699"/>
-    <color name="warning" value="#990000"/>
-    <color name="code" value="#CFDCED"/>
-        
-    <color name="footer" value="#cedfef"/>
--->
-
-  <!-- Collabnet --> 
-<!--
-    <color name="header"    value="#003366"/>
-
-    <color name="tab-selected" value="#dddddd" link="#555555" vlink="#555555" hlink="#555555"/>
-    <color name="tab-unselected" value="#999999" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
-    <color name="subtab-selected" value="#cccccc" link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="subtab-unselected" value="#cccccc" link="#555555" vlink="#555555" hlink="#555555"/>
-
-    <color name="heading" value="#003366"/>
-    <color name="subheading" value="#888888"/>
-    
-    <color name="navstrip" value="#dddddd" font="#555555"/>
-    <color name="toolbox" value="#dddddd" font="#555555"/>
-    <color name="border" value="#999999"/>
-    
-    <color name="menu" value="#ffffff"/>    
-    <color name="dialog" value="#eeeeee"/>
-            
-    <color name="body"      value="#ffffff"/>
-    
-    <color name="table" value="#ccc"/>    
-    <color name="table-cell" value="#ffffff"/>   
-    <color name="highlight" value="#ffff00"/>
-    <color name="fixme" value="#cc6600"/>
-    <color name="note" value="#006699"/>
-    <color name="warning" value="#990000"/>
-    <color name="code" value="#003366"/>
-        
-    <color name="footer" value="#ffffff"/>
--->
- <!-- Lenya using pelt-->
-<!--
-    <color name="header" value="#ffffff"/>
-
-    <color name="tab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
-    <color name="tab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="subtab-selected" value="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
-    <color name="subtab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
-
-    <color name="heading" value="#E5E4D9"/>
-    <color name="subheading" value="#000000"/>
-    <color name="published" value="#4C6C8F" font="#FFFFFF"/>
-    <color name="feedback" value="#4C6C8F" font="#FFFFFF" align="center"/>
-    <color name="navstrip" value="#E5E4D9" font="#000000"/>
-
-    <color name="toolbox" value="#CFDCED" font="#000000"/>
-
-    <color name="border" value="#999999"/>
-    <color name="menu" value="#4C6C8F" font="#ffffff" link="#ffffff" vlink="#ffffff" hlink="#ffffff" current="#FFCC33" />    
-    <color name="menuheading" value="#cfdced" font="#000000" />
-    <color name="searchbox" value="#E5E4D9" font="#000000"/>
-    
-    <color name="dialog" value="#CFDCED"/>
-    <color name="body" value="#ffffff" />            
-    
-    <color name="table" value="#ccc"/>    
-    <color name="table-cell" value="#ffffff"/>   
-    <color name="highlight" value="#ffff00"/>
-    <color name="fixme" value="#cc6600"/>
-    <color name="note" value="#006699"/>
-    <color name="warning" value="#990000"/>
-    <color name="code" value="#003366"/>
-        
-    <color name="footer" value="#E5E4D9"/>
--->
-  </colors>
- 
-  <!-- Settings specific to PDF output. -->
-  <pdf>
-    <!-- 
-       Supported page sizes are a0, a1, a2, a3, a4, a5, executive,
-       folio, legal, ledger, letter, quarto, tabloid (default letter).
-       Supported page orientations are portrait, landscape (default
-       portrait).
-       Supported text alignments are left, right, justify (default left).
-    -->
-    <page size="letter" orientation="portrait" text-align="left"/>
-
-    <!--
-       Margins can be specified for top, bottom, inner, and outer
-       edges. If double-sided="false", the inner edge is always left
-       and the outer is always right. If double-sided="true", the
-       inner edge will be left on odd pages, right on even pages,
-       the outer edge vice versa.
-       Specified below are the default settings.
-    -->
-    <margins double-sided="false">
-      <top>1in</top>
-      <bottom>1in</bottom>
-      <inner>1.25in</inner>
-      <outer>1in</outer>
-    </margins>
-
-    <!--
-      Print the URL text next to all links going outside the file
-    -->
-    <show-external-urls>false</show-external-urls>
-
-    <!--
-      Disable the copyright footer on each page of the PDF.
-      A footer is composed for each page. By default, a "credit" with role=pdf
-      will be used, as explained below. Otherwise a copyright statement
-      will be generated. This latter can be disabled.
-    -->
-    <disable-copyright-footer>false</disable-copyright-footer>
-  </pdf>
-
-  <!-- Credits are typically rendered as a set of small clickable
-    images in the page footer.
-    Use box-location="alt" to move the credit to an alternate location
-    (if the skin supports it). 
-  -->
-  <credits>
-    <credit box-location="alt">
-      <name>Built with Apache Forrest</name>
-      <url>http://forrest.apache.org/</url>
-      <image>images/built-with-forrest-button.png</image>
-      <width>88</width>
-      <height>31</height>
-    </credit>
-    <!-- A credit with @role="pdf" will be used to compose a footer
-     for each page in the PDF, using either "name" or "url" or both.
-    -->
-    <!--
-    <credit role="pdf">
-      <name>Built with Apache Forrest</name>
-      <url>http://forrest.apache.org/</url>
-    </credit>
-    -->
-  </credits>
-
-</skinconfig>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/status.xml
----------------------------------------------------------------------
diff --git a/src/docs/status.xml b/src/docs/status.xml
deleted file mode 100644
index 3ac3fda..0000000
--- a/src/docs/status.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-<status>
-
-  <developers>
-    <person name="Joe Bloggs"      email="joe@joescompany.org"      id="JB" />
-    <!-- Add more people here -->
-  </developers>
-
-  <changes>
-    <!-- Add new releases here -->
-    <release version="0.1" date="unreleased">
-      <!-- Some action types have associated images. By default, images are
-      defined for 'add', 'fix', 'remove', 'update' and 'hack'. If you add
-      src/documentation/resources/images/<foo>.jpg images, these will
-      automatically be used for entries of type <foo>. -->
-
-      <action dev="JB" type="add" context="admin">
-        Initial Import
-      </action>
-      <!-- Sample action:
-      <action dev="JB" type="fix" due-to="Joe Contributor"
-          due-to-email="joec@apache.org" fixes-bug="123">
-          Fixed a bug in the Foo class.
-        </action>
-        -->
-    </release>
-  </changes>
-
-  <todo>
-    <actions priority="high">
-      <action context="docs" dev="JB">
-        Customize this template project with your project's details.  This
-        TODO list is generated from 'status.xml'.
-      </action>
-      <action context="docs" dev="JB">
-        Add lots of content.  XML content goes in
-        <code>src/documentation/content/xdocs</code>, or wherever the
-        <code>${project.xdocs-dir}</code> property (set in
-        <code>forrest.properties</code>) points.
-      </action>
-      <action context="feedback" dev="JB">
-        Mail <link
-          href="mailto:forrest-dev@xml.apache.org">forrest-dev@xml.apache.org</link>
-        with feedback.
-      </action>
-    </actions>
-    <!-- Add todo items. @context is an arbitrary string. Eg:
-    <actions priority="high">
-      <action context="code" dev="SN">
-      </action>
-    </actions>
-    <actions priority="medium">
-      <action context="docs" dev="open">
-      </action>
-    </actions>
-    -->
-  </todo>
-
-</status>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/forrest.properties
----------------------------------------------------------------------
diff --git a/zookeeper-docs/forrest.properties b/zookeeper-docs/forrest.properties
new file mode 100644
index 0000000..70cf81d
--- /dev/null
+++ b/zookeeper-docs/forrest.properties
@@ -0,0 +1,109 @@
+# Copyright 2002-2004 The Apache Software Foundation
+#
+# Licensed 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.
+
+##############
+# Properties used by forrest.build.xml for building the website
+# These are the defaults, un-comment them if you need to change them.
+##############
+
+# Prints out a summary of Forrest settings for this project
+#forrest.echo=true 
+
+# Project name (used to name .war file)
+#project.name=my-project
+
+# Specifies name of Forrest skin to use
+#project.skin=tigris
+#project.skin=pelt
+
+# comma separated list, file:// is supported
+#forrest.skins.descriptors=http://forrest.apache.org/skins/skins.xml,file:///c:/myskins/skins.xml
+
+##############
+# behavioural properties
+#project.menu-scheme=tab_attributes
+#project.menu-scheme=directories
+
+##############
+# layout properties
+
+# Properties that can be set to override the default locations
+#
+# Parent properties must be set. This usually means uncommenting
+# project.content-dir if any other property using it is uncommented
+
+#project.status=status.xml
+#project.content-dir=src/documentation
+project.configfile=${project.home}/src/documentation/conf/cli.xconf
+#project.raw-content-dir=${project.content-dir}/content
+#project.conf-dir=${project.content-dir}/conf
+#project.sitemap-dir=${project.content-dir}
+#project.xdocs-dir=${project.content-dir}/content/xdocs
+#project.resources-dir=${project.content-dir}/resources
+#project.stylesheets-dir=${project.resources-dir}/stylesheets
+#project.images-dir=${project.resources-dir}/images
+#project.schema-dir=${project.resources-dir}/schema
+#project.skins-dir=${project.content-dir}/skins
+#project.skinconf=${project.content-dir}/skinconf.xml
+#project.lib-dir=${project.content-dir}/lib
+#project.classes-dir=${project.content-dir}/classes
+#project.translations-dir=${project.content-dir}/translations
+
+##############
+# validation properties
+
+# This set of properties determine if validation is performed
+# Values are inherited unless overridden.
+# e.g. if forrest.validate=false then all others are false unless set to true.
+forrest.validate=true
+forrest.validate.xdocs=${forrest.validate}
+forrest.validate.skinconf=${forrest.validate}
+forrest.validate.stylesheets=${forrest.validate}
+forrest.validate.skins=${forrest.validate}
+forrest.validate.skins.stylesheets=${forrest.validate.skins}
+
+# Make Forrest work with JDK6
+forrest.validate.sitemap=false
+
+# *.failonerror=(true|false) - stop when an XML file is invalid
+forrest.validate.failonerror=true
+
+# *.excludes=(pattern) - comma-separated list of path patterns to not validate
+# e.g.
+#forrest.validate.xdocs.excludes=samples/subdir/**, samples/faq.xml
+#forrest.validate.xdocs.excludes=
+
+
+##############
+# General Forrest properties
+
+# The URL to start crawling from
+#project.start-uri=linkmap.html
+# Set logging level for messages printed to the console
+# (DEBUG, INFO, WARN, ERROR, FATAL_ERROR)
+#project.debuglevel=ERROR
+# Max memory to allocate to Java
+#forrest.maxmemory=64m
+# Any other arguments to pass to the JVM. For example, to run on an X-less
+# server, set to -Djava.awt.headless=true
+#forrest.jvmargs=
+# The bugtracking URL - the issue number will be appended
+#project.bugtracking-url=http://issues.apache.org/bugzilla/show_bug.cgi?id=
+#project.bugtracking-url=http://issues.apache.org/jira/browse/
+# The issues list as rss
+#project.issues-rss-url=
+#I18n Property only works for the "forrest run" target.
+#project.i18n=true
+
+project.required.plugins=org.apache.forrest.plugin.output.pdf,org.apache.forrest.plugin.input.simplifiedDocbook

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/README.txt
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/README.txt b/zookeeper-docs/src/documentation/README.txt
new file mode 100644
index 0000000..9bc261b
--- /dev/null
+++ b/zookeeper-docs/src/documentation/README.txt
@@ -0,0 +1,7 @@
+This is the base documentation directory.
+
+skinconf.xml     # This file customizes Forrest for your project. In it, you
+                 # tell forrest the project name, logo, copyright info, etc
+
+sitemap.xmap     # Optional. This sitemap is consulted before all core sitemaps.
+                 # See http://forrest.apache.org/docs/project-sitemap.html

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/TODO.txt
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/TODO.txt b/zookeeper-docs/src/documentation/TODO.txt
new file mode 100644
index 0000000..84e7dfa
--- /dev/null
+++ b/zookeeper-docs/src/documentation/TODO.txt
@@ -0,0 +1,227 @@
+This is a running list of todo documentation items. Feel free
+to add to the list or take on an item as you wish (in the form
+of a JIRA patch of course).
+-------------------------------------------------------------
+
+recipes.xml:110:    
+[maybe an illustration would be nice for each recipe?]
+
+recipes.xml:167:                     
+"wait for each watch event". [how do you wait?]
+
+recipes.xml:457:          
+<remark>[tbd: myabe helpful to indicate which step this refers to?]</remark>
+
+zookeeperAdmin.xml:77:      
+because requires a majority <remark>[tbd: why?]</remark>, it is best to use...
+
+zookeeperAdmin.xml:112:   
+ <screen>$yinst -i jdk-1.6.0.00_3 -br test  <remark>[y! prop - replace with open equiv]</remark></screen>
+ 
+zookeeperAdmin.xml:99:         
+- use a maximum heap size of 3GB for a 4GB machine.  <remark>[tbd:  where would they do this? Environment variable, etc?]</remark>
+
+zookeeperAdmin.xml:120
+<screen>$ yinst install -nostart zookeeper_server <remark>[Y! prop - replace with open eq]</remark></screen>
+
+zookeeperAdmin.xml:171:              
+In Java, you can run the following command to execute simple operations:<remark> [tbd: also, maybe give some of those simple operations?]
+
+zookeeperAdmin.xml:194:          
+Running either program gives you a shell in which to execute simple file-system-like operations. <remark>[tbd: again, sample
+          operations?]
+
+zookeeperAdmin.xml:252:       
+If servers use different configuration files,
+care must be taken to ensure that the list of servers in all of the
+standard form, with legal values, etc]</remark>
+
+zookeeperAdmin.xml:408:
+(Note: The system property has no zookeeper
+prefix, and the configuration variable name is different from
+the system property. Yes - it's not consistent, and it's
+annoying.<remark> [tbd: is there any explanation for
+this?]</remark>)
+		
+zookeeperAdmin.xml:445:               When the election algorithm is
+                "0" a UDP port with the same port number as the port listed in
+                the <emphasis role="bold">server.num</emphasis> option will be
+                used. <remark>[tbd: should that be <emphasis
+                role="bold">server.id</emphasis>? Also, why isn't server.id
+                documented anywhere?]</remark>
+		
+zookeeperAdmin.xml:481:                The default to this option is yes, which
+                means that a leader will accept client connections.
+                <remark>[tbd: how do you specifiy which server is the
+                leader?]</remark>
+		
+zookeeperAdmin.xml:495		When the server
+                starts up, it determines which server it is by looking for the
+                file <filename>myid</filename> in the data directory.<remark>
+                [tdb: should we mention somewhere about creating this file,
+                myid, in the setup procedure?]</remark>
+		
+zookeeperAdmin.xml:508:               [tbd: is the next sentence explanation an of what the
+                election port or is it a description of a special case?]
+                </remark>If you want to test multiple servers on a single
+                machine, the individual choices of electionPort for each
+                server can be defined in each server's config files using the
+                line electionPort=xxxx to avoid clashes.
+		
+zookeeperAdmin.xml:524:               If followers fall too far behind a
+                leader, they will be dropped. <remark>[tbd: is this a correct
+                rewording: if followers fall beyond this limit, they are
+                dropped?]</remark>
+		
+zookeeperAdmin.xml:551:               ZooKeeper will not require updates
+                to be synced to the media. <remark>[tbd: useful because...,
+                dangerous because...]</remark>
+		
+zookeeperAdmin.xml:580:                Skips ACL checks. <remark>[tbd: when? where?]</remark>
+                
+zookeeperAdmin.xml:649:        <remark>[tbd: Patrick, Ben, et al: I believe the Message Broker
+        team does perform routine monitoring of Zookeeper. But I might be
+        wrong. To your knowledge, is there any monitoring of a Zookeeper
+        deployment that will a Zookeeper sys admin will want to do, outside of
+        Yahoo?]</remark>
+	
+zookeeperAdmin.xml:755:            Also,
+            the server lists in each Zookeeper server configuration file
+            should be consistent with one another. <remark>[tbd: I'm assuming
+            this last part is true. Is it?]</remark>
+	    
+zookeeperAdmin.xml:812:     For best results, take note of the following list of good
+      Zookeeper practices. <remark>[tbd: I just threw this section in. Do we
+      have list that is is different from the "things to avoid"? If not, I can
+      easily remove this section.]</remark>
+      
+
+zookeeperOver.xml:162:      Ephemeral nodes are useful when you
+      want to implement <remark>[tbd]</remark>.
+      
+zookeeperOver.xml:174:     And if the
+      connection between the client and one of the Zoo Keeper servers is
+      broken, the client will receive a local notification. These can be used
+      to <remark>[tbd]</remark>
+
+zookeeperOver.xml:215:            <para>For more information on these (guarantees), and how they can be used, see
+      <remark>[tbd]</remark></para>
+      
+zookeeperOver.xml:294:           <para><xref linkend="fg_zkComponents" /> shows the high-level components
+      of the ZooKeeper service. With the exception of the request processor,
+      <remark>[tbd: where does the request processor live?]</remark> 
+      
+zookeeperOver.xml:298:      <para><xref linkend="fg_zkComponents" /> shows the high-level components
+      of the ZooKeeper service. With the exception of the request processor,
+     each of
+      the servers that make up the ZooKeeper service replicates its own copy
+      of each of components. <remark>[tbd: I changed the wording in this
+      sentence from the white paper. Can someone please make sure it is still
+      correct?]</remark>
+      
+zookeeperOver.xml:342:      The programming interface to ZooKeeper is deliberately simple.
+      With it, however, you can implement higher order operations, such as
+      synchronizations primitives, group membership, ownership, etc. Some
+      distributed applications have used it to: <remark>[tbd: add uses from
+      white paper and video presentation.]</remark> 
+      
+
+zookeeperProgrammers.xml:94:              <listitem>
+        <para><xref linkend="ch_programStructureWithExample" />
+        <remark>[tbd]</remark></para>
+      </listitem>
+      
+zookeeperProgrammers.xml:115:     Also,
+    the <ulink url="#ch_programStructureWithExample">Simple Programmming
+    Example</ulink> <remark>[tbd]</remark> is helpful for understand the basic
+    structure of a ZooKeeper client application.
+    
+zookeeperProgrammers.xml:142:      The following characters are not
+				allowed  because <remark>[tbd:
+				do we need reasons?]</remark> 
+
+zookeeperProgrammers.xml:172:     If
+      the version it supplies doesn't match the actual version of the data,
+      the update will fail. (This behavior can be overridden. For more
+      information see... )<remark>[tbd... reference here to the section
+      describing the special version number -1]</remark>
+      
+zookeeperProgrammers.xml:197:        More information about watches can be
+        found in the section 
+	<ulink url="recipes.html#sc_recipes_Locks">
+	Zookeeper Watches</ulink>.
+        <remark>[tbd: fix this link] [tbd: Ben there is note from to emphasize
+        that "it is queued". What is "it" and is what we have here
+        sufficient?]</remark></para>
+	
+zookeeperProgrammers.xml:335:    it will send the session id as a part of the connection handshake.
+    As a security measure, the server creates a password for the session id
+    that any ZooKeeper server can validate. <remark>[tbd: note from Ben:
+    "perhaps capability is a better word." need clarification on that.]
+    </remark>
+    
+zookeeperProgrammers.xml:601:              <ulink
+              url="recipes.html#sc_recipes_Locks">Locks</ulink>
+              <remark>[tbd:...]</remark> in <ulink
+              url="recipes.html">Zookeeper Recipes</ulink>.
+              <remark>[tbd:..]</remark>).</para>
+	      
+zookeeperProgrammers.xml:766:             <para>See INSTALL for general information about running
+              <emphasis role="bold">configure</emphasis>. <remark>[tbd: what
+              is INSTALL? a directory? a file?]</remark></para>
+	     
+	      
+	      
+zookeeperProgrammers.xml:813:                <para>To verify that the node's been created:</para>
+
+        <para>You should see a list of node who are children of the root node
+        "/".</para><remark>[tbd: document all the cli commands (I think this is ben's comment)
+
+zookeeperProgrammers.xml:838:                <para>Refer to <xref linkend="ch_programStructureWithExample"/>for examples of usage in Java and C.
+        <remark>[tbd]</remark></para>
+
+zookeeperProgrammers.xml 847: <remark>[tbd: This is a new section. The below
+    is just placeholder. Eventually, a subsection on each of those operations, with a little
+    bit of illustrative code for each op.] </remark>
+    
+zookeeperProgrammers.xml:915:    Program Structure, with Simple Example</title>
+
+zookeeperProgrammers.xml:999:        <term>ZooKeeper Whitepaper <remark>[tbd: find url]</remark></term>
+
+zookeeperProgrammers.xml:1008:        <term>API Reference <remark>[tbd: find url]</remark></term>
+
+zookeeperProgrammers.xml:1062:        [tbd]</remark></term><listitem>
+          <para>Any other good sources anyone can think of...</para>
+        </listitem>
+
+zookeeperStarted.xml:73:            <para>[tbd: should we start w/ a word here about were to get the source,
+      exactly what to download, how to unpack it, and where to put it? Also,
+      does the user need to be in sudo, or can they be under their regular
+      login?]</para>
+      
+zookeeperStarted.xml:84:      <para>This should generate a JAR file called zookeeper.jar. To start
+      Zookeeper, compile and run zookeeper.jar. <emphasis>[tbd, some more
+      instruction here. Perhaps a command line? Are these two steps or
+      one?]</emphasis></para>
+      
+zookeeperStarted.xml:139:      <para>ZooKeeper logs messages using log4j -- more detail available in
+      the <ulink url="zookeeperProgrammers.html#Logging">Logging</ulink>
+      section of the Programmer's Guide.<remark revision="include_tbd">[tbd:
+      real reference needed]</remark> 
+      
+zookeeperStarted.xml:201:      The C bindings exist in two variants: single
+      threaded and multi-threaded. These differ only in how the messaging loop
+      is done. <remark>[tbd: what is the messaging loop? Do we talk about it
+      anywyhere? is this too much info for a getting started guide?]</remark>
+      
+zookeeperStarted.xml:217:      The entry <emphasis
+      role="bold">syncLimit</emphasis> limits how far out of date a server can
+      be from a leader. [TBD: someone please verify that the previous is
+      true.] 
+
+zookeeperStarted.xml:232:	These are the "electionPort" numbers of the servers (as opposed to
+      clientPorts), that is ports for <remark>[tbd: feedback need: what are
+      these ports, exactly?]
+      
+zookeeperStarted.xml:258:          <remark>[tbd: what is the other config param?
+          (I believe two are mentioned above.)]</remark>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/classes/CatalogManager.properties
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/classes/CatalogManager.properties b/zookeeper-docs/src/documentation/classes/CatalogManager.properties
new file mode 100644
index 0000000..ac060b9
--- /dev/null
+++ b/zookeeper-docs/src/documentation/classes/CatalogManager.properties
@@ -0,0 +1,37 @@
+# Copyright 2002-2004 The Apache Software Foundation
+#
+# Licensed 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.
+
+#=======================================================================
+# CatalogManager.properties
+#
+# This is the default properties file for Apache Forrest.
+# This facilitates local configuration of application-specific catalogs.
+#
+# See the Apache Forrest documentation:
+# http://forrest.apache.org/docs/your-project.html
+# http://forrest.apache.org/docs/validation.html
+
+# verbosity ... level of messages for status/debug
+# See forrest/src/core/context/WEB-INF/cocoon.xconf
+
+# catalogs ... list of additional catalogs to load
+#  (Note that Apache Forrest will automatically load its own default catalog
+#  from src/core/context/resources/schema/catalog.xcat)
+# use full pathnames
+# pathname separator is always semi-colon (;) regardless of operating system
+# directory separator is always slash (/) regardless of operating system
+#
+#catalogs=/home/me/forrest/my-site/src/documentation/resources/schema/catalog.xcat
+catalogs=
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/conf/cli.xconf
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/conf/cli.xconf b/zookeeper-docs/src/documentation/conf/cli.xconf
new file mode 100644
index 0000000..c671340
--- /dev/null
+++ b/zookeeper-docs/src/documentation/conf/cli.xconf
@@ -0,0 +1,328 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<!--+
+    |  This is the Apache Cocoon command line configuration file.
+    |  Here you give the command line interface details of where
+    |  to find various aspects of your Cocoon installation.
+    |
+    |  If you wish, you can also use this file to specify the URIs
+    |  that you wish to generate.
+    |
+    |  The current configuration information in this file is for
+    |  building the Cocoon documentation. Therefore, all links here
+    |  are relative to the build context dir, which, in the build.xml
+    |  file, is set to ${build.context}
+    |
+    |  Options:
+    |    verbose:            increase amount of information presented
+    |                        to standard output (default: false)
+    |    follow-links:       whether linked pages should also be
+    |                        generated (default: true)
+    |    precompile-only:    precompile sitemaps and XSP pages, but
+    |                        do not generate any pages (default: false)
+    |    confirm-extensions: check the mime type for the generated page
+    |                        and adjust filename and links extensions
+    |                        to match the mime type
+    |                        (e.g. text/html->.html)
+    |
+    |  Note: Whilst using an xconf file to configure the Cocoon
+    |        Command Line gives access to more features, the use of
+    |        command line parameters is more stable, as there are
+    |        currently plans to improve the xconf format to allow
+    |        greater flexibility. If you require a stable and
+    |        consistent method for accessing the CLI, it is recommended
+    |        that you use the command line parameters to configure
+    |        the CLI. See documentation at:
+    |        http://cocoon.apache.org/2.1/userdocs/offline/
+    |        http://wiki.apache.org/cocoon/CommandLine
+    |
+    +-->
+
+<cocoon verbose="true"
+        follow-links="true"
+        precompile-only="false"
+        confirm-extensions="false">
+
+   <!--+
+       |  The context directory is usually the webapp directory
+       |  containing the sitemap.xmap file.
+       |
+       |  The config file is the cocoon.xconf file.
+       |
+       |  The work directory is used by Cocoon to store temporary
+       |  files and cache files.
+       |
+       |  The destination directory is where generated pages will
+       |  be written (assuming the 'simple' mapper is used, see
+       |  below)
+       +-->
+   <context-dir>.</context-dir>
+   <config-file>WEB-INF/cocoon.xconf</config-file>
+   <work-dir>../tmp/cocoon-work</work-dir>
+   <dest-dir>../site</dest-dir>
+
+   <!--+
+       |  A checksum file can be used to store checksums for pages
+       |  as they are generated. When the site is next generated,
+       |  files will not be written if their checksum has not changed.
+       |  This means that it will be easier to detect which files
+       |  need to be uploaded to a server, using the timestamp.
+       |
+       |  The default path is relative to the core webapp directory.
+       |  An asolute path can be used.
+       +-->
+   <!--   <checksums-uri>build/work/checksums</checksums-uri>-->
+
+   <!--+
+       | Broken link reporting options:
+       |   Report into a text file, one link per line:
+       |     <broken-links type="text" report="filename"/>
+       |   Report into an XML file:
+       |     <broken-links type="xml" report="filename"/>
+       |   Ignore broken links (default):
+       |     <broken-links type="none"/>
+       |
+       |   Two attributes to this node specify whether a page should
+       |   be generated when an error has occurred. 'generate' specifies
+       |   whether a page should be generated (default: true) and
+       |   extension specifies an extension that should be appended
+       |   to the generated page's filename (default: none)
+       |
+       |   Using this, a quick scan through the destination directory
+       |   will show broken links, by their filename extension.
+       +-->
+   <broken-links type="xml"
+                 file="../brokenlinks.xml"
+                 generate="false"
+                 extension=".error"
+                 show-referrers="true"/>
+
+   <!--+
+       |  Load classes at startup. This is necessary for generating
+       |  from sites that use SQL databases and JDBC.
+       |  The <load-class> element can be repeated if multiple classes
+       |  are needed.
+       +-->
+   <!--
+   <load-class>org.firebirdsql.jdbc.Driver</load-class>
+   -->
+
+   <!--+
+       |  Configures logging.
+       |  The 'log-kit' parameter specifies the location of the log kit
+       |  configuration file (usually called logkit.xconf.
+       |
+       |  Logger specifies the logging category (for all logging prior
+       |  to other Cocoon logging categories taking over)
+       |
+       |  Available log levels are:
+       |    DEBUG:        prints all level of log messages.
+       |    INFO:         prints all level of log messages except DEBUG
+       |                  ones.
+       |    WARN:         prints all level of log messages except DEBUG
+       |                  and INFO ones.
+       |    ERROR:        prints all level of log messages except DEBUG,
+       |                  INFO and WARN ones.
+       |    FATAL_ERROR:  prints only log messages of this level
+       +-->
+   <!-- <logging log-kit="WEB-INF/logkit.xconf" logger="cli" level="ERROR" /> -->
+
+   <!--+
+       |  Specifies the filename to be appended to URIs that
+       |  refer to a directory (i.e. end with a forward slash).
+       +-->
+   <default-filename>index.html</default-filename>
+
+   <!--+
+       |  Specifies a user agent string to the sitemap when
+       |  generating the site.
+       |
+       |  A generic term for a web browser is "user agent". Any
+       |  user agent, when connecting to a web server, will provide
+       |  a string to identify itself (e.g. as Internet Explorer or
+       |  Mozilla). It is possible to have Cocoon serve different
+       |  content depending upon the user agent string provided by
+       |  the browser. If your site does this, then you may want to
+       |  use this <user-agent> entry to provide a 'fake' user agent
+       |  to Cocoon, so that it generates the correct version of your
+       |  site.
+       |
+       |  For most sites, this can be ignored.
+       +-->
+   <!--
+   <user-agent>Cocoon Command Line Environment 2.1</user-agent>
+   -->
+
+   <!--+
+       |  Specifies an accept string to the sitemap when generating
+       |  the site.
+       |  User agents can specify to an HTTP server what types of content
+       |  (by mime-type) they are able to receive. E.g. a browser may be
+       |  able to handle jpegs, but not pngs. The HTTP accept header
+       |  allows the server to take the browser's capabilities into account,
+       |  and only send back content that it can handle.
+       |
+       |  For most sites, this can be ignored.
+       +-->
+
+   <accept>*/*</accept>
+
+   <!--+
+       | Specifies which URIs should be included or excluded, according
+       | to wildcard patterns.
+       |
+       | These includes/excludes are only relevant when you are following
+       | links. A link URI must match an include pattern (if one is given)
+       | and not match an exclude pattern, if it is to be followed by
+       | Cocoon. It can be useful, for example, where there are links in
+       | your site to pages that are not generated by Cocoon, such as
+       | references to api-documentation.
+       |
+       | By default, all URIs are included. If both include and exclude
+       | patterns are specified, a URI is first checked against the
+       | include patterns, and then against the exclude patterns.
+       |
+       | Multiple patterns can be given, using muliple include or exclude
+       | nodes.
+       |
+       | The order of the elements is not significant, as only the first
+       | successful match of each category is used.
+       |
+       | Currently, only the complete source URI can be matched (including
+       | any URI prefix). Future plans include destination URI matching
+       | and regexp matching. If you have requirements for these, contact
+       | dev@cocoon.apache.org.
+       +-->
+
+   <exclude pattern="**/"/>
+   <exclude pattern="**apidocs**"/>
+   <exclude pattern="api/**"/>
+
+   <!-- ZOOKEEPER-2364 - we build our own release notes separately -->
+   <exclude pattern="releasenotes.**"/>
+
+<!--
+  This is a workaround for FOR-284 "link rewriting broken when
+  linking to xml source views which contain site: links".
+  See the explanation there and in declare-broken-site-links.xsl
+-->
+   <exclude pattern="site:**"/>
+   <exclude pattern="ext:**"/>
+   <exclude pattern="lm:**"/>
+   <exclude pattern="**/site:**"/>
+   <exclude pattern="**/ext:**"/>
+   <exclude pattern="**/lm:**"/>
+
+   <!-- Exclude tokens used in URLs to ASF mirrors (interpreted by a CGI) -->
+   <exclude pattern="[preferred]/**"/>
+   <exclude pattern="[location]"/>
+
+   <!--   <include-links extension=".html"/>-->
+
+   <!--+
+       |  <uri> nodes specify the URIs that should be generated, and
+       |  where required, what should be done with the generated pages.
+       |  They describe the way the URI of the generated file is created
+       |  from the source page's URI. There are three ways that a generated
+       |  file URI can be created: append, replace and insert.
+       |
+       |  The "type" attribute specifies one of (append|replace|insert):
+       |
+       |  append:
+       |  Append the generated page's URI to the end of the source URI:
+       |
+       |   <uri type="append" src-prefix="documents/" src="index.html"
+       |   dest="build/dest/"/>
+       |
+       |  This means that
+       |   (1) the "documents/index.html" page is generated
+       |   (2) the file will be written to "build/dest/documents/index.html"
+       |
+       |  replace:
+       |  Completely ignore the generated page's URI - just
+       |  use the destination URI:
+       |
+       |   <uri type="replace" src-prefix="documents/" src="index.html"
+       |   dest="build/dest/docs.html"/>
+       |
+       |  This means that
+       |   (1) the "documents/index.html" page is generated
+       |   (2) the result is written to "build/dest/docs.html"
+       |   (3) this works only for "single" pages - and not when links
+       |       are followed
+       |
+       |  insert:
+       |  Insert generated page's URI into the destination
+       |  URI at the point marked with a * (example uses fictional
+       |  zip protocol)
+       |
+       |   <uri type="insert" src-prefix="documents/" src="index.html"
+       |   dest="zip://*.zip/page.html"/>
+       |
+       |  This means that
+       |   (1)
+       |
+       |  In any of these scenarios, if the dest attribute is omitted,
+       |  the value provided globally using the <dest-dir> node will
+       |  be used instead.
+       +-->
+   <!--
+   <uri type="replace"
+        src-prefix="samples/"
+        src="hello-world/hello.html"
+        dest="build/dest/hello-world.html"/>
+   -->
+
+   <!--+
+       | <uri> nodes can be grouped together in a <uris> node. This
+       | enables a group of URIs to share properties. The following
+       | properties can be set for a group of URIs:
+       |   * follow-links:       should pages be crawled for links
+       |   * confirm-extensions: should file extensions be checked
+       |                         for the correct mime type
+       |   * src-prefix:         all source URIs should be
+       |                         pre-pended with this prefix before
+       |                         generation. The prefix is not
+       |                         included when calculating the
+       |                         destination URI
+       |   * dest:               the base destination URI to be
+       |                         shared by all pages in this group
+       |   * type:               the method to be used to calculate
+       |                         the destination URI. See above
+       |                         section on <uri> node for details.
+       |
+       | Each <uris> node can have a name attribute. When a name
+       | attribute has been specified, the -n switch on the command
+       | line can be used to tell Cocoon to only process the URIs
+       | within this URI group. When no -n switch is given, all
+       | <uris> nodes are processed. Thus, one xconf file can be
+       | used to manage multiple sites.
+       +-->
+   <!--
+   <uris name="mirrors" follow-links="false">
+     <uri type="append" src="mirrors.html"/>
+   </uris>
+   -->
+
+   <!--+
+       |  File containing URIs (plain text, one per line).
+       +-->
+   <!--
+   <uri-file>uris.txt</uri-file>
+   -->
+</cocoon>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/index.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/index.xml b/zookeeper-docs/src/documentation/content/xdocs/index.xml
new file mode 100644
index 0000000..969e482
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/index.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+  
+  <header>
+    <title>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</title>
+  </header>
+  
+  <body>
+    <p>ZooKeeper is a high-performance coordination service for
+      distributed applications.  It exposes common services - such as
+      naming, configuration management, synchronization, and group
+      services - in a simple interface so you don't have to write them
+      from scratch.  You can use it off-the-shelf to implement
+      consensus, group management, leader election, and presence
+      protocols. And you can build on it for your own, specific needs.
+    </p>
+
+    <p>
+      The following documents describe concepts and procedures to get
+      you started using ZooKeeper. If you have more questions, please
+      ask the <a href="ext:lists">mailing list</a> or browse the
+      archives.
+    </p>
+    <ul>
+
+      <li><strong>ZooKeeper Overview</strong><p>Technical Overview Documents for Client Developers, Adminstrators, and Contributors</p>
+      <ul><li><a href="zookeeperOver.html">Overview</a> - a bird's eye view of ZooKeeper, including design concepts and architecture</li>
+      <li><a href="zookeeperStarted.html">Getting Started</a> - a tutorial-style guide for developers to install, run, and program to ZooKeeper</li>
+      <li><a href="ext:relnotes">Release Notes</a> - new developer and user facing features, improvements, and incompatibilities</li>
+      </ul>
+      </li>
+      
+      <li><strong>Developers</strong><p> Documents for Developers using the ZooKeeper Client API</p>
+      <ul>
+            <li><a href="ext:api/index">API Docs</a> - the technical reference to ZooKeeper Client APIs</li>
+      <li><a href="zookeeperProgrammers.html">Programmer's Guide</a> - a client application developer's guide to ZooKeeper</li>
+      <li><a href="javaExample.html">ZooKeeper Java Example</a> - a simple Zookeeper client appplication, written in Java</li>
+      <li><a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> - sample implementations of barriers and queues</li>  
+      <li><a href="recipes.html">ZooKeeper Recipes</a> - higher level solutions to common problems in distributed applications</li>
+      </ul>
+      </li>
+      
+      <li><strong>Administrators &amp; Operators</strong> <p> Documents for Administrators and Operations Engineers of ZooKeeper Deployments</p>
+      <ul>
+      <li><a href="zookeeperAdmin.html">Administrator's Guide</a> - a guide for system administrators and anyone else who might deploy ZooKeeper</li>
+      <li><a href="zookeeperQuotas.html">Quota Guide</a> - a guide for system administrators on Quotas in ZooKeeper. </li>
+      <li><a href="zookeeperJMX.html">JMX</a> - how to enable JMX in ZooKeeper</li>
+      <li><a href="zookeeperHierarchicalQuorums.html">Hierarchical quorums</a></li>
+      <li><a href="zookeeperObservers.html">Observers</a> - non-voting ensemble members that easily improve ZooKeeper's scalability</li>
+      <li><a href="zookeeperReconfig.html">Dynamic Reconfiguration</a> - a guide on how to use dynamic reconfiguration in ZooKeeper</li>
+      </ul>
+      </li>
+      
+      <li><strong>Contributors</strong><p> Documents for Developers Contributing to the ZooKeeper Open Source Project</p>
+      <ul>
+      <li><a href="zookeeperInternals.html">ZooKeeper Internals</a> - assorted topics on the inner workings of ZooKeeper</li>
+      </ul>
+      </li>
+      
+      <li><strong>Miscellaneous ZooKeeper Documentation</strong>
+      <ul>
+      <li><a href="ext:wiki">Wiki</a></li>
+      <li><a href="ext:faq">FAQ</a></li>    
+      </ul>
+      </li>
+    </ul>
+  </body>
+  
+</document>


[10/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml b/src/docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
deleted file mode 100644
index f71c4a8..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="zk_HierarchicalQuorums">
-  <title>Introduction to hierarchical quorums</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This document contains information about hierarchical quorums.</para>
-    </abstract>
-  </articleinfo>
-
-    <para>
-    This document gives an example of how to use hierarchical quorums. The basic idea is
-    very simple. First, we split servers into groups, and add a line for each group listing
-    the servers that form this group. Next we have to assign a weight to each server.  
-    </para>
-    
-    <para>
-    The following example shows how to configure a system with three groups of three servers
-    each, and we assign a weight of 1 to each server:
-    </para>
-    
-    <programlisting>
-    group.1=1:2:3
-    group.2=4:5:6
-    group.3=7:8:9
-   
-    weight.1=1
-    weight.2=1
-    weight.3=1
-    weight.4=1
-    weight.5=1
-    weight.6=1
-    weight.7=1
-    weight.8=1
-    weight.9=1
- 	</programlisting>
-
-	<para>    
-    When running the system, we are able to form a quorum once we have a majority of votes from
-    a majority of non-zero-weight groups. Groups that have zero weight are discarded and not
-    considered when forming quorums. Looking at the example, we are able to form a quorum once
-    we have votes from at least two servers from each of two different groups.
-    </para> 
- </article>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml b/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
deleted file mode 100644
index 7815bc1..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
+++ /dev/null
@@ -1,487 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="ar_ZooKeeperInternals">
-  <title>ZooKeeper Internals</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This article contains topics which discuss the inner workings of
-       ZooKeeper. So far, that's logging and atomic broadcast. </para>
-
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_Introduction">
-    <title>Introduction</title>
-
-    <para>This document contains information on the inner workings of ZooKeeper. 
-    So far, it discusses these topics:
-    </para>
-
-<itemizedlist>    
-<listitem><para><xref linkend="sc_atomicBroadcast"/></para></listitem>
-<listitem><para><xref linkend="sc_logging"/></para></listitem>
-</itemizedlist>
-
-</section>
-
-<section id="sc_atomicBroadcast">
-<title>Atomic Broadcast</title>
-
-<para>
-At the heart of ZooKeeper is an atomic messaging system that keeps all of the servers in sync.</para>
-
-<section id="sc_guaranteesPropertiesDefinitions"><title>Guarantees, Properties, and Definitions</title>
-<para>
-The specific guarantees provided by the messaging system used by ZooKeeper are the following:</para>
-
-<variablelist>
-
-<varlistentry><term><emphasis >Reliable delivery</emphasis></term>
-<listitem><para>If a message, m, is delivered 
-by one server, it will be eventually delivered by all servers.</para></listitem></varlistentry>
-
-<varlistentry><term><emphasis >Total order</emphasis></term>
-<listitem><para> If a message is 
-delivered before message b by one server, a will be delivered before b by all 
-servers. If a and b are delivered messages, either a will be delivered before b 
-or b will be delivered before a.</para></listitem></varlistentry>
-
-<varlistentry><term><emphasis >Causal order</emphasis> </term>
-
-<listitem><para>
-If a message b is sent after a message a has been delivered by the sender of b, 
-a must be ordered before b. If a sender sends c after sending b, c must be ordered after b.
-</para></listitem></varlistentry>
-
-</variablelist>
-
-
-<para>
-The ZooKeeper messaging system also needs to be efficient, reliable, and easy to 
-implement and maintain. We make heavy use of messaging, so we need the system to 
-be able to handle thousands of requests per second. Although we can require at 
-least k+1 correct servers to send new messages, we must be able to recover from 
-correlated failures such as power outages. When we implemented the system we had 
-little time and few engineering resources, so we needed a protocol that is 
-accessible to engineers and is easy to implement. We found that our protocol 
-satisfied all of these goals.
-
-</para>
-
-<para>
-Our protocol assumes that we can construct point-to-point FIFO channels between 
-the servers. While similar services usually assume message delivery that can 
-lose or reorder messages, our assumption of FIFO channels is very practical 
-given that we use TCP for communication. Specifically we rely on the following property of TCP:</para>
-
-<variablelist>
-
-<varlistentry>
-<term><emphasis >Ordered delivery</emphasis></term>
-<listitem><para>Data is delivered in the same order it is sent and a message m is 
-delivered only after all messages sent before m have been delivered. 
-(The corollary to this is that if message m is lost all messages after m will be lost.)</para></listitem></varlistentry>
-
-<varlistentry><term><emphasis >No message after close</emphasis></term>
-<listitem><para>Once a FIFO channel is closed, no messages will be received from it.</para></listitem></varlistentry>
-
-</variablelist>
-
-<para>
-FLP proved that consensus cannot be achieved in asynchronous distributed systems 
-if failures are possible. To ensure we achieve consensus in the presence of failures 
-we use timeouts. However, we rely on times for liveness not for correctness. So, 
-if timeouts stop working (clocks malfunction for example) the messaging system may 
-hang, but it will not violate its guarantees.</para>
-
-<para>When describing the ZooKeeper messaging protocol we will talk of packets, 
-proposals, and messages:</para>
-<variablelist>
-<varlistentry><term><emphasis >Packet</emphasis></term>
-<listitem><para>a sequence of bytes sent through a FIFO channel</para></listitem></varlistentry><varlistentry>
-
-<term><emphasis >Proposal</emphasis></term>
-<listitem><para>a unit of agreement. Proposals are agreed upon by exchanging packets 
-with a quorum of ZooKeeper servers. Most proposals contain messages, however the 
-NEW_LEADER proposal is an example of a proposal that does not correspond to a message.</para></listitem>
-</varlistentry><varlistentry>
-
-<term><emphasis >Message</emphasis></term>
-<listitem><para>a sequence of bytes to be atomically broadcast to all ZooKeeper 
-servers. A message put into a proposal and agreed upon before it is delivered.</para></listitem>
-</varlistentry>
-
-</variablelist>
-
-<para>
-As stated above, ZooKeeper guarantees a total order of messages, and it also 
-guarantees a total order of proposals. ZooKeeper exposes the total ordering using
-a ZooKeeper transaction id (<emphasis>zxid</emphasis>). All proposals will be stamped with a zxid when 
-it is proposed and exactly reflects the total ordering. Proposals are sent to all 
-ZooKeeper servers and committed when a quorum of them acknowledge the proposal. 
-If a proposal contains a message, the message will be delivered when the proposal 
-is committed. Acknowledgement means the server has recorded the proposal to persistent storage. 
-Our quorums have the requirement that any pair of quorum must have at least one server 
-in common. We ensure this by requiring that all quorums have size (<emphasis>n/2+1</emphasis>) where 
-n is the number of servers that make up a ZooKeeper service.
-</para>
-
-<para>
-The zxid has two parts: the epoch and a counter. In our implementation the zxid 
-is a 64-bit number. We use the high order 32-bits for the epoch and the low order 
-32-bits for the counter. Because it has two parts represent the zxid both as a 
-number and as a pair of integers, (<emphasis>epoch, count</emphasis>). The epoch number represents a 
-change in leadership. Each time a new leader comes into power it will have its 
-own epoch number. We have a simple algorithm to assign a unique zxid to a proposal: 
-the leader simply increments the zxid to obtain a unique zxid for each proposal. 
-<emphasis>Leadership activation will ensure that only one leader uses a given epoch, so our 
-simple algorithm guarantees that every proposal will have a unique id.</emphasis>
-</para>
-
-<para>
-ZooKeeper messaging consists of two phases:</para>
-
-<variablelist>
-<varlistentry><term><emphasis >Leader activation</emphasis></term>
-<listitem><para>In this phase a leader establishes the correct state of the system 
-and gets ready to start making proposals.</para></listitem>
-</varlistentry>
-
-<varlistentry><term><emphasis >Active messaging</emphasis></term>
-<listitem><para>In this phase a leader accepts messages to propose and coordinates message delivery.</para></listitem>
-</varlistentry>
-</variablelist>
-
-<para>
-ZooKeeper is a holistic protocol. We do not focus on individual proposals, rather 
-look at the stream of proposals as a whole. Our strict ordering allows us to do this 
-efficiently and greatly simplifies our protocol. Leadership activation embodies 
-this holistic concept. A leader becomes active only when a quorum of followers 
-(The leader counts as a follower as well. You can always vote for yourself ) has synced 
-up with the leader, they have the same state. This state consists of all of the 
-proposals that the leader believes have been committed and the proposal to follow 
-the leader, the NEW_LEADER proposal. (Hopefully you are thinking to 
-yourself, <emphasis>Does the set of proposals that the leader believes has been committed 
-included all the proposals that really have been committed?</emphasis> The answer is <emphasis>yes</emphasis>. 
-Below, we make clear why.)
-</para>
-
-</section>
-
-<section id="sc_leaderElection">
-
-<title>Leader Activation</title>
-<para>
-Leader activation includes leader election. We currently have two leader election 
-algorithms in ZooKeeper: LeaderElection and FastLeaderElection (AuthFastLeaderElection 
-is a variant of FastLeaderElection that uses UDP and allows servers to perform a simple
-form of authentication to avoid IP spoofing). ZooKeeper messaging doesn't care about the 
-exact method of electing a leader has long as the following holds:
-</para>
-
-<itemizedlist>
-
-<listitem><para>The leader has seen the highest zxid of all the followers.</para></listitem>
-<listitem><para>A quorum of servers have committed to following the leader.</para></listitem>
-
-</itemizedlist>
-
-<para>
-Of these two requirements only the first, the highest zxid amoung the followers 
-needs to hold for correct operation. The second requirement, a quorum of followers, 
-just needs to hold with high probability. We are going to recheck the second requirement, 
-so if a failure happens during or after the leader election and quorum is lost, 
-we will recover by abandoning leader activation and running another election.
-</para>
-
-<para>
-After leader election a single server will be designated as a leader and start 
-waiting for followers to connect. The rest of the servers will try to connect to 
-the leader. The leader will sync up with followers by sending any proposals they 
-are missing, or if a follower is missing too many proposals, it will send a full 
-snapshot of the state to the follower.
-</para>
-
-<para>
-There is a corner case in which a follower that has proposals, U, not seen 
-by a leader arrives. Proposals are seen in order, so the proposals of U will have a zxids 
-higher than zxids seen by the leader. The follower must have arrived after the 
-leader election, otherwise the follower would have been elected leader given that 
-it has seen a higher zxid. Since committed proposals must be seen by a quorum of 
-servers, and a quorum of servers that elected the leader did not see U, the proposals 
-of you have not been committed, so they can be discarded. When the follower connects 
-to the leader, the leader will tell the follower to discard U.
-</para>
-
-<para>
-A new leader establishes a zxid to start using for new proposals by getting the 
-epoch, e, of the highest zxid it has seen and setting the next zxid to use to be 
-(e+1, 0), fter the leader syncs with a follower, it will propose a NEW_LEADER 
-proposal. Once the NEW_LEADER proposal has been committed, the leader will activate 
-and start receiving and issuing proposals.
-</para>
-
-<para>
-It all sounds complicated but here are the basic rules of operation during leader 
-activation:
-</para>
-
-<itemizedlist>
-<listitem><para>A follower will ACK the NEW_LEADER proposal after it has synced with the leader.</para></listitem>
-<listitem><para>A follower will only ACK a NEW_LEADER proposal with a given zxid from a single server.</para></listitem>
-<listitem><para>A new leader will COMMIT the NEW_LEADER proposal when a quorum of followers have ACKed it.</para></listitem>
-<listitem><para>A follower will commit any state it received from the leader when the NEW_LEADER proposal is COMMIT.</para></listitem>
-<listitem><para>A new leader will not accept new proposals until the NEW_LEADER proposal has been COMMITED.</para></listitem>
-</itemizedlist>
-
-<para>
-If leader election terminates erroneously, we don't have a problem since the 
-NEW_LEADER proposal will not be committed since the leader will not have quorum. 
-When this happens, the leader and any remaining followers will timeout and go back 
-to leader election.
-</para>
-
-</section>
-
-<section id="sc_activeMessaging">
-<title>Active Messaging</title>
-<para>
-Leader Activation does all the heavy lifting. Once the leader is coronated he can 
-start blasting out proposals. As long as he remains the leader no other leader can 
-emerge since no other leader will be able to get a quorum of followers. If a new 
-leader does emerge, 
-it means that the leader has lost quorum, and the new leader will clean up any 
-mess left over during her leadership activation.
-</para>
-
-<para>ZooKeeper messaging operates similar to a classic two-phase commit.</para>
-
-<mediaobject id="fg_2phaseCommit" >
-  <imageobject>
-    <imagedata fileref="images/2pc.jpg"/>
-  </imageobject>
-</mediaobject>
-
-<para>
-All communication channels are FIFO, so everything is done in order. Specifically 
-the following operating constraints are observed:</para>
-
-<itemizedlist>
-
-<listitem><para>The leader sends proposals to all followers using 
-the same order. Moreover, this order follows the order in which requests have been 
-received. Because we use FIFO channels this means that followers also receive proposals in order.
-</para></listitem>
-
-<listitem><para>Followers process messages in the order they are received. This 
-means that messages will be ACKed in order and the leader will receive ACKs from 
-followers in order, due to the FIFO channels. It also means that if message $m$ 
-has been written to non-volatile storage, all messages that were proposed before 
-$m$ have been written to non-volatile storage.</para></listitem>
-
-<listitem><para>The leader will issue a COMMIT to all followers as soon as a 
-quorum of followers have ACKed a message. Since messages are ACKed in order, 
-COMMITs will be sent by the leader as received by the followers in order.</para></listitem>
-
-<listitem><para>COMMITs are processed in order. Followers deliver a proposals 
-message when that proposal is committed.</para></listitem>
-
-</itemizedlist>
-
-</section>
-
-<section id="sc_summary">
-<title>Summary</title>
-<para>So there you go. Why does it work? Specifically, why does a set of proposals 
-believed by a new leader always contain any proposal that has actually been committed? 
-First, all proposals have a unique zxid, so unlike other protocols, we never have 
-to worry about two different values being proposed for the same zxid; followers 
-(a leader is also a follower) see and record proposals in order; proposals are 
-committed in order; there is only one active leader at a time since followers only 
-follow a single leader at a time; a new leader has seen all committed proposals 
-from the previous epoch since it has seen the highest zxid from a quorum of servers; 
-any uncommited proposals from a previous epoch seen by a new leader will be committed 
-by that leader before it becomes active.</para></section>
-
-<section id="sc_comparisons"><title>Comparisons</title>
-<para>
-Isn't this just Multi-Paxos? No, Multi-Paxos requires some way of assuring that 
-there is only a single coordinator. We do not count on such assurances. Instead 
-we use the leader activation to recover from leadership change or old leaders 
-believing they are still active.
-</para>
-
-<para>
-Isn't this just Paxos? Your active messaging phase looks just like phase 2 of Paxos? 
-Actually, to us active messaging looks just like 2 phase commit without the need to 
-handle aborts. Active messaging is different from both in the sense that it has 
-cross proposal ordering requirements. If we do not maintain strict FIFO ordering of 
-all packets, it all falls apart. Also, our leader activation phase is different from 
-both of them. In particular, our use of epochs allows us to skip blocks of uncommitted
-proposals and to not worry about duplicate proposals for a given zxid.
-</para>
-
-</section>
-
-</section>
-
-<section id="sc_quorum">
-<title>Quorums</title>
-
-<para>
-Atomic broadcast and leader election use the notion of quorum to guarantee a consistent
-view of the system. By default, ZooKeeper uses majority quorums, which means that every
-voting that happens in one of these protocols requires a majority to vote on. One example is
-acknowledging a leader proposal: the leader can only commit once it receives an
-acknowledgement from a quorum of servers.
-</para>
-
-<para>
-If we extract the properties that we really need from our use of majorities, we have that we only
-need to guarantee that groups of processes used to validate an operation by voting (e.g., acknowledging
-a leader proposal) pairwise intersect in at least one server. Using majorities guarantees such a property.
-However, there are other ways of constructing quorums different from majorities. For example, we can assign
-weights to the votes of servers, and say that the votes of some servers are more important. To obtain a quorum,
-we get enough votes so that the sum of weights of all votes is larger than half of the total sum of all weights.    
-</para>
-
-<para>
-A different construction that uses weights and is useful in wide-area deployments (co-locations) is a hierarchical
-one. With this construction, we split the servers into disjoint groups and assign weights to processes. To form 
-a quorum, we have to get a hold of enough servers from a majority of groups G, such that for each group g in G,
-the sum of votes from g is larger than half of the sum of weights in g. Interestingly, this construction enables
-smaller quorums. If we have, for example, 9 servers, we split them into 3 groups, and assign a weight of 1 to each
-server, then we are able to form quorums of size 4. Note that two subsets of processes composed each of a majority
-of servers from each of a majority of groups necessarily have a non-empty intersection. It is reasonable to expect
-that a majority of co-locations will have a majority of servers available with high probability. 
-</para>  
-
-<para>
-With ZooKeeper, we provide a user with the ability of configuring servers to use majority quorums, weights, or a 
-hierarchy of groups.
-</para>
-</section>
-
-<section id="sc_logging">
-
-<title>Logging</title>
-<para>
-Zookeeper uses 
-<ulink url="http://www.slf4j.org/index.html">slf4j</ulink> as an abstraction layer for logging. 
-<ulink url="http://logging.apache.org/log4j">log4j</ulink> in version 1.2 is chosen as the final logging implementation for now.
-For better embedding support, it is planned in the future to leave the decision of choosing the final logging implementation to the end user.
-Therefore, always use the slf4j api to write log statements in the code, but configure log4j for how to log at runtime.
-Note that slf4j has no FATAL level, former messages at FATAL level have been moved to ERROR level. 
-For information on configuring log4j for
-ZooKeeper, see the <ulink url="zookeeperAdmin.html#sc_logging">Logging</ulink> section 
-of the <ulink url="zookeeperAdmin.html">ZooKeeper Administrator's Guide.</ulink>
-
-</para>
-
-<section id="sc_developerGuidelines"><title>Developer Guidelines</title>
-
-<para>Please follow the  
-<ulink url="http://www.slf4j.org/manual.html">slf4j manual</ulink> when creating log statements within code.
-Also read the
-<ulink url="http://www.slf4j.org/faq.html#logging_performance">FAQ on performance</ulink>
-, when creating log statements. Patch reviewers will look for the following:</para>
-<section id="sc_rightLevel"><title>Logging at the Right Level</title>
-<para>
-There are several levels of logging in slf4j. 
-It's important to pick the right one. In order of higher to lower severity:</para>
-<orderedlist>
-   <listitem><para>ERROR level designates error events that might still allow the application to continue running.</para></listitem>
-   <listitem><para>WARN level designates potentially harmful situations.</para></listitem>
-   <listitem><para>INFO level designates informational messages that highlight the progress of the application at coarse-grained level.</para></listitem>
-   <listitem><para>DEBUG Level designates fine-grained informational events that are most useful to debug an application.</para></listitem>
-   <listitem><para>TRACE Level designates finer-grained informational events than the DEBUG.</para></listitem>
-</orderedlist>
-
-<para>
-ZooKeeper is typically run in production such that log messages of INFO level 
-severity and higher (more severe) are output to the log.</para>
-
-
-</section>
-
-<section id="sc_slf4jIdioms"><title>Use of Standard slf4j Idioms</title>
-
-<para><emphasis>Static Message Logging</emphasis></para>
-<programlisting>
-LOG.debug("process completed successfully!");
-</programlisting>
-
-<para>
-However when creating parameterized messages are required, use formatting anchors.
-</para>
-
-<programlisting>
-LOG.debug("got {} messages in {} minutes",new Object[]{count,time});    
-</programlisting>
-
-
-<para><emphasis>Naming</emphasis></para>
-
-<para>
-Loggers should be named after the class in which they are used.
-</para>
-
-<programlisting>
-public class Foo {
-    private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
-    ....
-    public Foo() {
-       LOG.info("constructing Foo");
-</programlisting>
-
-<para><emphasis>Exception handling</emphasis></para>
-<programlisting>
-try {
-  // code
-} catch (XYZException e) {
-  // do this
-  LOG.error("Something bad happened", e);
-  // don't do this (generally)
-  // LOG.error(e);
-  // why? because "don't do" case hides the stack trace
- 
-  // continue process here as you need... recover or (re)throw
-}
-</programlisting>
-</section>
-</section>
-
-</section>
-
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperJMX.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperJMX.xml b/src/docs/src/documentation/content/xdocs/zookeeperJMX.xml
deleted file mode 100644
index f0ea636..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperJMX.xml
+++ /dev/null
@@ -1,236 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_zookeeperjmx">
-  <title>ZooKeeper JMX</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>ZooKeeper support for JMX</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_jmx">
-    <title>JMX</title>
-    <para>Apache ZooKeeper has extensive support for JMX, allowing you
-    to view and manage a ZooKeeper serving ensemble.</para>
-
-    <para>This document assumes that you have basic knowledge of
-    JMX. See <ulink
-    url="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">
-    Sun JMX Technology</ulink> page to get started with JMX.
-    </para>
-
-    <para>See the <ulink
-    url="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html">
-    JMX Management Guide</ulink> for details on setting up local and
-    remote management of VM instances. By default the included
-    <emphasis>zkServer.sh</emphasis> supports only local management -
-    review the linked document to enable support for remote management
-    (beyond the scope of this document).
-    </para>
-
-  </section>
-
-  <section id="ch_starting">
-    <title>Starting ZooKeeper with JMX enabled</title>
-
-    <para>The class
-      <emphasis>org.apache.zookeeper.server.quorum.QuorumPeerMain</emphasis>
-      will start a JMX manageable ZooKeeper server. This class
-      registers the proper MBeans during initalization to support JMX
-      monitoring and management of the
-      instance. See <emphasis>bin/zkServer.sh</emphasis> for one
-      example of starting ZooKeeper using QuorumPeerMain.</para>
-  </section>
-
-  <section id="ch_console">
-    <title>Run a JMX console</title>
-
-    <para>There are a number of JMX consoles available which can connect
-      to the running server. For this example we will use Sun's
-      <emphasis>jconsole</emphasis>.</para>
-
-    <para>The Java JDK ships with a simple JMX console
-      named <ulink url="http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html">jconsole</ulink>
-      which can be used to connect to ZooKeeper and inspect a running
-      server. Once you've started ZooKeeper using QuorumPeerMain
-      start <emphasis>jconsole</emphasis>, which typically resides in
-      <emphasis>JDK_HOME/bin/jconsole</emphasis></para>
-
-    <para>When the "new connection" window is displayed either connect
-      to local process (if jconsole started on same host as Server) or
-      use the remote process connection.</para>
-
-    <para>By default the "overview" tab for the VM is displayed (this
-      is a great way to get insight into the VM btw). Select
-      the "MBeans" tab.</para>
-
-    <para>You should now see <emphasis>org.apache.ZooKeeperService</emphasis>
-      on the left hand side. Expand this item and depending on how you've
-      started the server you will be able to monitor and manage various
-      service related features.</para>
-
-    <para>Also note that ZooKeeper will register log4j MBeans as
-    well. In the same section along the left hand side you will see
-    "log4j". Expand that to manage log4j through JMX. Of particular
-    interest is the ability to dynamically change the logging levels
-    used by editing the appender and root thresholds. Log4j MBean
-    registration can be disabled by passing
-    <emphasis>-Dzookeeper.jmx.log4j.disable=true</emphasis> to the JVM
-    when starting ZooKeeper.
-    </para>
-
-  </section>
-
-  <section id="ch_reference">
-    <title>ZooKeeper MBean Reference</title>
-
-    <para>This table details JMX for a server participating in a
-    replicated ZooKeeper ensemble (ie not standalone). This is the
-    typical case for a production environment.</para>
-
-    <table>
-      <title>MBeans, their names and description</title>
-
-      <tgroup cols='4'>
-        <thead>
-          <row>
-            <entry>MBean</entry>
-            <entry>MBean Object Name</entry>
-            <entry>Description</entry>
-          </row>
-        </thead>
-        <tbody>
-          <row>
-            <entry>Quorum</entry>
-            <entry>ReplicatedServer_id&lt;#&gt;</entry>
-            <entry>Represents the Quorum, or Ensemble - parent of all
-            cluster members. Note that the object name includes the
-            "myid" of the server (name suffix) that your JMX agent has
-            connected to.</entry>
-          </row>
-          <row>
-            <entry>LocalPeer|RemotePeer</entry>
-            <entry>replica.&lt;#&gt;</entry>
-            <entry>Represents a local or remote peer (ie server
-            participating in the ensemble). Note that the object name
-            includes the "myid" of the server (name suffix).</entry>
-          </row>
-          <row>
-            <entry>LeaderElection</entry>
-            <entry>LeaderElection</entry>
-            <entry>Represents a ZooKeeper cluster leader election which is
-            in progress. Provides information about the election, such as
-            when it started.</entry>
-          </row>
-          <row>
-            <entry>Leader</entry>
-            <entry>Leader</entry>
-            <entry>Indicates that the parent replica is the leader and
-            provides attributes/operations for that server. Note that
-            Leader is a subclass of ZooKeeperServer, so it provides
-            all of the information normally associated with a
-            ZooKeeperServer node.</entry>
-          </row>
-          <row>
-            <entry>Follower</entry>
-            <entry>Follower</entry>
-            <entry>Indicates that the parent replica is a follower and
-            provides attributes/operations for that server. Note that
-            Follower is a subclass of ZooKeeperServer, so it provides
-            all of the information normally associated with a
-            ZooKeeperServer node.</entry>
-          </row>
-          <row>
-            <entry>DataTree</entry>
-            <entry>InMemoryDataTree</entry>
-            <entry>Statistics on the in memory znode database, also
-            operations to access finer (and more computationally
-            intensive) statistics on the data (such as ephemeral
-            count). InMemoryDataTrees are children of ZooKeeperServer
-            nodes.</entry>
-          </row>
-          <row>
-            <entry>ServerCnxn</entry>
-            <entry>&lt;session_id&gt;</entry>
-            <entry>Statistics on each client connection, also
-            operations on those connections (such as
-            termination). Note the object name is the session id of
-            the connection in hex form.</entry>
-          </row>
-    </tbody></tgroup></table>
-
-    <para>This table details JMX for a standalone server. Typically
-    standalone is only used in development situations.</para>
-
-    <table>
-      <title>MBeans, their names and description</title>
-
-      <tgroup cols='4'>
-        <thead>
-          <row>
-            <entry>MBean</entry>
-            <entry>MBean Object Name</entry>
-            <entry>Description</entry>
-          </row>
-        </thead>
-        <tbody>
-          <row>
-            <entry>ZooKeeperServer</entry>
-            <entry>StandaloneServer_port&lt;#&gt;</entry>
-            <entry>Statistics on the running server, also operations
-            to reset these attributes. Note that the object name
-            includes the client port of the server (name
-            suffix).</entry>
-          </row>
-          <row>
-            <entry>DataTree</entry>
-            <entry>InMemoryDataTree</entry>
-            <entry>Statistics on the in memory znode database, also
-            operations to access finer (and more computationally
-            intensive) statistics on the data (such as ephemeral
-            count).</entry>
-          </row>
-          <row>
-            <entry>ServerCnxn</entry>
-            <entry>&lt;session_id&gt;</entry>
-            <entry>Statistics on each client connection, also
-            operations on those connections (such as
-            termination). Note the object name is the session id of
-            the connection in hex form.</entry>
-          </row>
-    </tbody></tgroup></table>
-
-  </section>
-
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperObservers.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperObservers.xml b/src/docs/src/documentation/content/xdocs/zookeeperObservers.xml
deleted file mode 100644
index fab6769..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperObservers.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_GettStartedGuide">
-  <title>ZooKeeper Observers</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-      
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This guide contains information about using non-voting servers, or
-      observers in your ZooKeeper ensembles.</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_Introduction">
-    <title>Observers: Scaling ZooKeeper Without Hurting Write Performance
-      </title>
-    <para>
-      Although ZooKeeper performs very well by having clients connect directly
-      to voting members of the ensemble, this architecture makes it hard to
-      scale out to huge numbers of clients. The problem is that as we add more
-      voting members, the write performance drops. This is due to the fact that
-      a write operation requires the agreement of (in general) at least half the
-      nodes in an ensemble and therefore the cost of a vote can increase
-      significantly as more voters are added.
-    </para>
-    <para>
-      We have introduced a new type of ZooKeeper node called
-      an <emphasis>Observer</emphasis> which helps address this problem and
-      further improves ZooKeeper's scalability. Observers are non-voting members
-      of an ensemble which only hear the results of votes, not the agreement
-      protocol that leads up to them. Other than this simple distinction,
-      Observers function exactly the same as Followers - clients may connect to
-      them and send read and write requests to them. Observers forward these
-      requests to the Leader like Followers do, but they then simply wait to
-      hear the result of the vote. Because of this, we can increase the number
-      of Observers as much as we like without harming the performance of votes.
-    </para>
-    <para>
-      Observers have other advantages. Because they do not vote, they are not a
-      critical part of the ZooKeeper ensemble. Therefore they can fail, or be
-      disconnected from the cluster, without harming the availability of the
-      ZooKeeper service. The benefit to the user is that Observers may connect
-      over less reliable network links than Followers. In fact, Observers may be
-      used to talk to a ZooKeeper server from another data center. Clients of
-      the Observer will see fast reads, as all reads are served locally, and
-      writes result in minimal network traffic as the number of messages
-      required in the absence of the vote protocol is smaller.
-    </para>
-  </section>
-  <section id="sc_UsingObservers">
-    <title>How to use Observers</title>
-    <para>Setting up a ZooKeeper ensemble that uses Observers is very simple,
-    and requires just two changes to your config files. Firstly, in the config
-    file of every node that is to be an Observer, you must place this line:
-    </para>
-    <programlisting>
-      peerType=observer
-    </programlisting>
-    
-    <para>
-      This line tells ZooKeeper that the server is to be an Observer. Secondly,
-      in every server config file, you must add :observer to the server
-      definition line of each Observer. For example:
-    </para>
-    
-    <programlisting>
-      server.1:localhost:2181:3181:observer
-    </programlisting>
-    
-    <para>
-      This tells every other server that server.1 is an Observer, and that they
-      should not expect it to vote. This is all the configuration you need to do
-      to add an Observer to your ZooKeeper cluster. Now you can connect to it as
-      though it were an ordinary Follower. Try it out, by running:</para>
-    <programlisting>
-      $ bin/zkCli.sh -server localhost:2181
-    </programlisting>
-    <para>
-      where localhost:2181 is the hostname and port number of the Observer as
-      specified in every config file. You should see a command line prompt
-      through which you can issue commands like <emphasis>ls</emphasis> to query
-      the ZooKeeper service.
-    </para>
-  </section>
-  
-  <section id="ch_UseCases">
-    <title>Example use cases</title>
-    <para>
-      Two example use cases for Observers are listed below. In fact, wherever
-      you wish to scale the number of clients of your ZooKeeper ensemble, or
-      where you wish to insulate the critical part of an ensemble from the load
-      of dealing with client requests, Observers are a good architectural
-      choice.
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para> As a datacenter bridge: Forming a ZK ensemble between two
-	datacenters is a problematic endeavour as the high variance in latency
-	between the datacenters could lead to false positive failure detection
-	and partitioning. However if the ensemble runs entirely in one
-	datacenter, and the second datacenter runs only Observers, partitions
-	aren't problematic as the ensemble remains connected. Clients of the
-	Observers may still see and issue proposals.</para>
-      </listitem>
-      <listitem>
-	<para>As a link to a message bus: Some companies have expressed an
-	interest in using ZK as a component of a persistent reliable message
-	bus. Observers would give a natural integration point for this work: a
-	plug-in mechanism could be used to attach the stream of proposals an
-	Observer sees to a publish-subscribe system, again without loading the
-	core ensemble.
-	</para>
-      </listitem>
-    </itemizedlist>
-  </section>
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml b/src/docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
deleted file mode 100644
index a2445b1..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_OtherInfo">
-  <title>ZooKeeper</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para> currently empty </para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_placeholder">
-    <title>Other Info</title>
-    <para> currently empty </para>
-  </section>
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperOver.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperOver.xml b/src/docs/src/documentation/content/xdocs/zookeeperOver.xml
deleted file mode 100644
index f972657..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperOver.xml
+++ /dev/null
@@ -1,464 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_Overview">
-  <title>ZooKeeper</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This document contains overview information about ZooKeeper. It
-      discusses design goals, key concepts, implementation, and
-      performance.</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_DesignOverview">
-    <title>ZooKeeper: A Distributed Coordination Service for Distributed
-    Applications</title>
-
-    <para>ZooKeeper is a distributed, open-source coordination service for
-    distributed applications. It exposes a simple set of primitives that
-    distributed applications can build upon to implement higher level services
-    for synchronization, configuration maintenance, and groups and naming. It
-    is designed to be easy to program to, and uses a data model styled after
-    the familiar directory tree structure of file systems. It runs in Java and
-    has bindings for both Java and C.</para>
-
-    <para>Coordination services are notoriously hard to get right. They are
-    especially prone to errors such as race conditions and deadlock. The
-    motivation behind ZooKeeper is to relieve distributed applications the
-    responsibility of implementing coordination services from scratch.</para>
-
-    <section id="sc_designGoals">
-      <title>Design Goals</title>
-
-      <para><emphasis role="bold">ZooKeeper is simple.</emphasis> ZooKeeper
-      allows distributed processes to coordinate with each other through a
-      shared hierarchal namespace which is organized similarly to a standard
-      file system. The name space consists of data registers - called znodes,
-      in ZooKeeper parlance - and these are similar to files and directories.
-      Unlike a typical file system, which is designed for storage, ZooKeeper
-      data is kept in-memory, which means ZooKeeper can achieve high
-      throughput and low latency numbers.</para>
-
-      <para>The ZooKeeper implementation puts a premium on high performance,
-      highly available, strictly ordered access. The performance aspects of
-      ZooKeeper means it can be used in large, distributed systems. The
-      reliability aspects keep it from being a single point of failure. The
-      strict ordering means that sophisticated synchronization primitives can
-      be implemented at the client.</para>
-
-      <para><emphasis role="bold">ZooKeeper is replicated.</emphasis> Like the
-      distributed processes it coordinates, ZooKeeper itself is intended to be
-      replicated over a sets of hosts called an ensemble.</para>
-
-      <figure>
-        <title>ZooKeeper Service</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata fileref="images/zkservice.jpg" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>The servers that make up the ZooKeeper service must all know about
-      each other. They maintain an in-memory image of state, along with a
-      transaction logs and snapshots in a persistent store. As long as a
-      majority of the servers are available, the ZooKeeper service will be
-      available.</para>
-
-      <para>Clients connect to a single ZooKeeper server. The client maintains
-      a TCP connection through which it sends requests, gets responses, gets
-      watch events, and sends heart beats. If the TCP connection to the server
-      breaks, the client will connect to a different server.</para>
-
-      <para><emphasis role="bold">ZooKeeper is ordered.</emphasis> ZooKeeper
-      stamps each update with a number that reflects the order of all
-      ZooKeeper transactions. Subsequent operations can use the order to
-      implement higher-level abstractions, such as synchronization
-      primitives.</para>
-
-      <para><emphasis role="bold">ZooKeeper is fast.</emphasis> It is
-      especially fast in "read-dominant" workloads. ZooKeeper applications run
-      on thousands of machines, and it performs best where reads are more
-      common than writes, at ratios of around 10:1.</para>
-    </section>
-
-    <section id="sc_dataModelNameSpace">
-      <title>Data model and the hierarchical namespace</title>
-
-      <para>The name space provided by ZooKeeper is much like that of a
-      standard file system. A name is a sequence of path elements separated by
-      a slash (/). Every node in ZooKeeper's name space is identified by a
-      path.</para>
-
-      <figure>
-        <title>ZooKeeper's Hierarchical Namespace</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata fileref="images/zknamespace.jpg" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-    </section>
-
-    <section>
-      <title>Nodes and ephemeral nodes</title>
-
-      <para>Unlike standard file systems, each node in a ZooKeeper
-      namespace can have data associated with it as well as children. It is
-      like having a file-system that allows a file to also be a directory.
-      (ZooKeeper was designed to store coordination data: status information,
-      configuration, location information, etc., so the data stored at each
-      node is usually small, in the byte to kilobyte range.) We use the term
-      <emphasis>znode</emphasis> to make it clear that we are talking about
-      ZooKeeper data nodes.</para>
-
-      <para>Znodes maintain a stat structure that includes version numbers for
-      data changes, ACL changes, and timestamps, to allow cache validations
-      and coordinated updates. Each time a znode's data changes, the version
-      number increases. For instance, whenever a client retrieves data it also
-      receives the version of the data.</para>
-
-      <para>The data stored at each znode in a namespace is read and written
-      atomically. Reads get all the data bytes associated with a znode and a
-      write replaces all the data. Each node has an Access Control List (ACL)
-      that restricts who can do what.</para>
-
-      <para>ZooKeeper also has the notion of ephemeral nodes. These znodes
-      exists as long as the session that created the znode is active. When the
-      session ends the znode is deleted. Ephemeral nodes are useful when you
-      want to implement <emphasis>[tbd]</emphasis>.</para>
-    </section>
-
-    <section>
-      <title>Conditional updates and watches</title>
-
-      <para>ZooKeeper supports the concept of <emphasis>watches</emphasis>.
-      Clients can set a watch on a znode. A watch will be triggered and
-      removed when the znode changes. When a watch is triggered, the client
-      receives a packet saying that the znode has changed. If the
-      connection between the client and one of the Zoo Keeper servers is
-      broken, the client will receive a local notification. These can be used
-      to <emphasis>[tbd]</emphasis>.</para>
-    </section>
-
-    <section>
-      <title>Guarantees</title>
-
-      <para>ZooKeeper is very fast and very simple. Since its goal, though, is
-      to be a basis for the construction of more complicated services, such as
-      synchronization, it provides a set of guarantees. These are:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>Sequential Consistency - Updates from a client will be applied
-          in the order that they were sent.</para>
-        </listitem>
-
-        <listitem>
-          <para>Atomicity - Updates either succeed or fail. No partial
-          results.</para>
-        </listitem>
-
-        <listitem>
-          <para>Single System Image - A client will see the same view of the
-          service regardless of the server that it connects to.</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>Reliability - Once an update has been applied, it will persist
-          from that time forward until a client overwrites the update.</para>
-        </listitem>
-      </itemizedlist>
-
-      <itemizedlist>
-        <listitem>
-          <para>Timeliness - The clients view of the system is guaranteed to
-          be up-to-date within a certain time bound.</para>
-        </listitem>
-      </itemizedlist>
-
-      <para>For more information on these, and how they can be used, see
-      <emphasis>[tbd]</emphasis></para>
-    </section>
-
-    <section>
-      <title>Simple API</title>
-
-      <para>One of the design goals of ZooKeeper is provide a very simple
-      programming interface. As a result, it supports only these
-      operations:</para>
-
-      <variablelist>
-        <varlistentry>
-          <term>create</term>
-
-          <listitem>
-            <para>creates a node at a location in the tree</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>delete</term>
-
-          <listitem>
-            <para>deletes a node</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>exists</term>
-
-          <listitem>
-            <para>tests if a node exists at a location</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>get data</term>
-
-          <listitem>
-            <para>reads the data from a node</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>set data</term>
-
-          <listitem>
-            <para>writes data to a node</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>get children</term>
-
-          <listitem>
-            <para>retrieves a list of children of a node</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term>sync</term>
-
-          <listitem>
-            <para>waits for data to be propagated</para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-
-      <para>For a more in-depth discussion on these, and how they can be used
-      to implement higher level operations, please refer to
-      <emphasis>[tbd]</emphasis></para>
-    </section>
-
-    <section>
-      <title>Implementation</title>
-
-      <para><xref linkend="fg_zkComponents" /> shows the high-level components
-      of the ZooKeeper service. With the exception of the request processor,
-     each of
-      the servers that make up the ZooKeeper service replicates its own copy
-      of each of the components.</para>
-
-      <figure id="fg_zkComponents">
-        <title>ZooKeeper Components</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata fileref="images/zkcomponents.jpg" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>The replicated database is an in-memory database containing the
-      entire data tree. Updates are logged to disk for recoverability, and
-      writes are serialized to disk before they are applied to the in-memory
-      database.</para>
-
-      <para>Every ZooKeeper server services clients. Clients connect to
-      exactly one server to submit irequests. Read requests are serviced from
-      the local replica of each server database. Requests that change the
-      state of the service, write requests, are processed by an agreement
-      protocol.</para>
-
-      <para>As part of the agreement protocol all write requests from clients
-      are forwarded to a single server, called the
-      <emphasis>leader</emphasis>. The rest of the ZooKeeper servers, called
-      <emphasis>followers</emphasis>, receive message proposals from the
-      leader and agree upon message delivery. The messaging layer takes care
-      of replacing leaders on failures and syncing followers with
-      leaders.</para>
-
-      <para>ZooKeeper uses a custom atomic messaging protocol. Since the
-      messaging layer is atomic, ZooKeeper can guarantee that the local
-      replicas never diverge. When the leader receives a write request, it
-      calculates what the state of the system is when the write is to be
-      applied and transforms this into a transaction that captures this new
-      state.</para>
-    </section>
-
-    <section>
-      <title>Uses</title>
-
-      <para>The programming interface to ZooKeeper is deliberately simple.
-      With it, however, you can implement higher order operations, such as
-      synchronizations primitives, group membership, ownership, etc. Some
-      distributed applications have used it to: <emphasis>[tbd: add uses from
-      white paper and video presentation.]</emphasis> For more information, see
-      <emphasis>[tbd]</emphasis></para>
-    </section>
-
-    <section>
-      <title>Performance</title>
-
-      <para>ZooKeeper is designed to be highly performant. But is it? The
-      results of the ZooKeeper's development team at Yahoo! Research indicate
-      that it is. (See <xref linkend="fg_zkPerfRW" />.) It is especially high
-      performance in applications where reads outnumber writes, since writes
-      involve synchronizing the state of all servers. (Reads outnumbering
-      writes is typically the case for a coordination service.)</para>
-
-      <figure id="fg_zkPerfRW">
-        <title>ZooKeeper Throughput as the Read-Write Ratio Varies</title>
-
-        <mediaobject>
-          <imageobject>
-            <imagedata fileref="images/zkperfRW-3.2.jpg" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-      <para>The figure <xref linkend="fg_zkPerfRW"/> is a throughput
-      graph of ZooKeeper release 3.2 running on servers with dual 2Ghz
-      Xeon and two SATA 15K RPM drives.  One drive was used as a
-      dedicated ZooKeeper log device. The snapshots were written to
-      the OS drive. Write requests were 1K writes and the reads were
-      1K reads.  "Servers" indicate the size of the ZooKeeper
-      ensemble, the number of servers that make up the
-      service. Approximately 30 other servers were used to simulate
-      the clients. The ZooKeeper ensemble was configured such that
-      leaders do not allow connections from clients.</para>
-
-      <note><para>In version 3.2 r/w performance improved by ~2x
-      compared to the <ulink
-      url="http://zookeeper.apache.org/docs/r3.1.1/zookeeperOver.html#Performance">previous
-      3.1 release</ulink>.</para></note>
-
-      <para>Benchmarks also indicate that it is reliable, too. <xref
-      linkend="fg_zkPerfReliability" /> shows how a deployment responds to
-      various failures. The events marked in the figure are the
-      following:</para>
-
-      <orderedlist>
-        <listitem>
-          <para>Failure and recovery of a follower</para>
-        </listitem>
-
-        <listitem>
-          <para>Failure and recovery of a different follower</para>
-        </listitem>
-
-        <listitem>
-          <para>Failure of the leader</para>
-        </listitem>
-
-        <listitem>
-          <para>Failure and recovery of two followers</para>
-        </listitem>
-
-        <listitem>
-          <para>Failure of another leader</para>
-        </listitem>
-      </orderedlist>
-    </section>
-
-    <section>
-      <title>Reliability</title>
-
-      <para>To show the behavior of the system over time as
-        failures are injected we ran a ZooKeeper service made up of
-        7 machines. We ran the same saturation benchmark as before,
-        but this time we kept the write percentage at a constant
-        30%, which is a conservative ratio of our expected
-        workloads.
-      </para>
-      <figure id="fg_zkPerfReliability">
-        <title>Reliability in the Presence of Errors</title>
-        <mediaobject>
-          <imageobject>
-            <imagedata fileref="images/zkperfreliability.jpg" />
-          </imageobject>
-        </mediaobject>
-      </figure>
-
-      <para>The are a few important observations from this graph. First, if
-      followers fail and recover quickly, then ZooKeeper is able to sustain a
-      high throughput despite the failure. But maybe more importantly, the
-      leader election algorithm allows for the system to recover fast enough
-      to prevent throughput from dropping substantially. In our observations,
-      ZooKeeper takes less than 200ms to elect a new leader. Third, as
-      followers recover, ZooKeeper is able to raise throughput again once they
-      start processing requests.</para>
-    </section>
-
-    <section>
-      <title>The ZooKeeper Project</title>
-
-      <para>ZooKeeper has been
-          <ulink url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy">
-          successfully used
-        </ulink>
-        in many industrial applications.  It is used at Yahoo! as the
-        coordination and failure recovery service for Yahoo! Message
-        Broker, which is a highly scalable publish-subscribe system
-        managing thousands of topics for replication and data
-        delivery.  It is used by the Fetching Service for Yahoo!
-        crawler, where it also manages failure recovery. A number of
-        Yahoo! advertising systems also use ZooKeeper to implement
-        reliable services.
-      </para>
-
-      <para>All users and developers are encouraged to join the
-        community and contribute their expertise. See the
-        <ulink url="http://zookeeper.apache.org/">
-          Zookeeper Project on Apache
-        </ulink>
-        for more information.
-      </para>
-    </section>
-  </section>
-</article>


[11/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml b/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
deleted file mode 100644
index 62edb2a..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
+++ /dev/null
@@ -1,2353 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_Admin">
-  <title>ZooKeeper Administrator's Guide</title>
-
-  <subtitle>A Guide to Deployment and Administration</subtitle>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This document contains information about deploying, administering
-      and mantaining ZooKeeper. It also discusses best practices and common
-      problems.</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_deployment">
-    <title>Deployment</title>
-
-    <para>This section contains information about deploying Zookeeper and
-    covers these topics:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para><xref linkend="sc_systemReq" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="sc_zkMulitServerSetup" /></para>
-      </listitem>
-
-      <listitem>
-        <para><xref linkend="sc_singleAndDevSetup" /></para>
-      </listitem>
-    </itemizedlist>
-
-    <para>The first two sections assume you are interested in installing
-    ZooKeeper in a production environment such as a datacenter. The final
-    section covers situations in which you are setting up ZooKeeper on a
-    limited basis - for evaluation, testing, or development - but not in a
-    production environment.</para>
-
-    <section id="sc_systemReq">
-      <title>System Requirements</title>
-
-      <section id="sc_supportedPlatforms">
-        <title>Supported Platforms</title>
-
-        <para>ZooKeeper consists of multiple components.  Some components are
-        supported broadly, and other components are supported only on a smaller
-        set of platforms.</para>
-
-        <itemizedlist>
-          <listitem>
-            <para><emphasis role="bold">Client</emphasis> is the Java client
-            library, used by applications to connect to a ZooKeeper ensemble.
-            </para>
-          </listitem>
-          <listitem>
-            <para><emphasis role="bold">Server</emphasis> is the Java server
-            that runs on the ZooKeeper ensemble nodes.</para>
-          </listitem>
-          <listitem>
-            <para><emphasis role="bold">Native Client</emphasis> is a client
-            implemented in C, similar to the Java client, used by applications
-            to connect to a ZooKeeper ensemble.</para>
-          </listitem>
-          <listitem>
-            <para><emphasis role="bold">Contrib</emphasis> refers to multiple
-            optional add-on components.</para>
-          </listitem>
-        </itemizedlist>
-
-        <para>The following matrix describes the level of support committed for
-        running each component on different operating system platforms.</para>
-
-        <table>
-          <title>Support Matrix</title>
-          <tgroup cols="5" align="left" colsep="1" rowsep="1">
-            <thead>
-              <row>
-                <entry>Operating System</entry>
-                <entry>Client</entry>
-                <entry>Server</entry>
-                <entry>Native Client</entry>
-                <entry>Contrib</entry>
-              </row>
-            </thead>
-            <tbody>
-              <row>
-                <entry>GNU/Linux</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-              </row>
-              <row>
-                <entry>Solaris</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-                <entry>Not Supported</entry>
-                <entry>Not Supported</entry>
-              </row>
-              <row>
-                <entry>FreeBSD</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-                <entry>Not Supported</entry>
-                <entry>Not Supported</entry>
-              </row>
-              <row>
-                <entry>Windows</entry>
-                <entry>Development and Production</entry>
-                <entry>Development and Production</entry>
-                <entry>Not Supported</entry>
-                <entry>Not Supported</entry>
-              </row>
-              <row>
-                <entry>Mac OS X</entry>
-                <entry>Development Only</entry>
-                <entry>Development Only</entry>
-                <entry>Not Supported</entry>
-                <entry>Not Supported</entry>
-              </row>
-            </tbody>
-          </tgroup>
-        </table>
-
-        <para>For any operating system not explicitly mentioned as supported in
-        the matrix, components may or may not work.  The ZooKeeper community
-        will fix obvious bugs that are reported for other platforms, but there
-        is no full support.</para>
-      </section>
-
-      <section id="sc_requiredSoftware">
-        <title>Required Software </title>
-
-        <para>ZooKeeper runs in Java, release 1.8 or greater (JDK 8 or
-        greater, FreeBSD support requires openjdk8).  It runs as an
-        <emphasis>ensemble</emphasis> of ZooKeeper servers. Three
-        ZooKeeper servers is the minimum recommended size for an
-        ensemble, and we also recommend that they run on separate
-        machines. At Yahoo!, ZooKeeper is usually deployed on
-        dedicated RHEL boxes, with dual-core processors, 2GB of RAM,
-        and 80GB IDE hard drives.</para>
-      </section>
-
-    </section>
-
-    <section id="sc_zkMulitServerSetup">
-      <title>Clustered (Multi-Server) Setup</title>
-
-      <para>For reliable ZooKeeper service, you should deploy ZooKeeper in a
-      cluster known as an <emphasis>ensemble</emphasis>. As long as a majority
-      of the ensemble are up, the service will be available. Because Zookeeper
-      requires a majority, it is best to use an
-      odd number of machines. For example, with four machines ZooKeeper can
-      only handle the failure of a single machine; if two machines fail, the
-      remaining two machines do not constitute a majority. However, with five
-      machines ZooKeeper can handle the failure of two machines. </para>
-      <note>
-         <para>
-            As mentioned in the
-            <ulink url="zookeeperStarted.html">ZooKeeper Getting Started Guide</ulink>
-            , a minimum of three servers are required for a fault tolerant
-            clustered setup, and it is strongly recommended that you have an
-            odd number of servers.
-         </para>
-         <para>Usually three servers is more than enough for a production
-            install, but for maximum reliability during maintenance, you may
-            wish to install five servers. With three servers, if you perform
-            maintenance on one of them, you are vulnerable to a failure on one
-            of the other two servers during that maintenance. If you have five
-            of them running, you can take one down for maintenance, and know
-            that you're still OK if one of the other four suddenly fails.
-         </para>
-         <para>Your redundancy considerations should include all aspects of
-            your environment. If you have three ZooKeeper servers, but their
-            network cables are all plugged into the same network switch, then
-            the failure of that switch will take down your entire ensemble.
-         </para>
-      </note>
-      <para>Here are the steps to setting a server that will be part of an
-      ensemble. These steps should be performed on every host in the
-      ensemble:</para>
-
-      <orderedlist>
-        <listitem>
-          <para>Install the Java JDK. You can use the native packaging system
-          for your system, or download the JDK from:</para>
-
-          <para><ulink
-          url="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</ulink></para>
-        </listitem>
-
-        <listitem>
-          <para>Set the Java heap size. This is very important to avoid
-          swapping, which will seriously degrade ZooKeeper performance. To
-          determine the correct value, use load tests, and make sure you are
-          well below the usage limit that would cause you to swap. Be
-          conservative - use a maximum heap size of 3GB for a 4GB
-          machine.</para>
-        </listitem>
-
-        <listitem>
-          <para>Install the ZooKeeper Server Package. It can be downloaded
-            from:
-          </para>
-          <para>
-            <ulink url="http://zookeeper.apache.org/releases.html">
-              http://zookeeper.apache.org/releases.html
-            </ulink>
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>Create a configuration file. This file can be called anything.
-          Use the following settings as a starting point:</para>
-
-          <programlisting>
-tickTime=2000
-dataDir=/var/lib/zookeeper/
-clientPort=2181
-initLimit=5
-syncLimit=2
-server.1=zoo1:2888:3888
-server.2=zoo2:2888:3888
-server.3=zoo3:2888:3888</programlisting>
-
-          <para>You can find the meanings of these and other configuration
-          settings in the section <xref linkend="sc_configuration" />. A word
-          though about a few here:</para>
-
-          <para>Every machine that is part of the ZooKeeper ensemble should know
-          about every other machine in the ensemble. You accomplish this with
-          the series of lines of the form <emphasis
-          role="bold">server.id=host:port:port</emphasis>. The parameters <emphasis
-          role="bold">host</emphasis> and <emphasis
-          role="bold">port</emphasis> are straightforward. You attribute the
-          server id to each machine by creating a file named
-          <filename>myid</filename>, one for each server, which resides in
-          that server's data directory, as specified by the configuration file
-          parameter <emphasis role="bold">dataDir</emphasis>.</para></listitem>
-
-          <listitem><para>The myid file
-          consists of a single line containing only the text of that machine's
-          id. So <filename>myid</filename> of server 1 would contain the text
-          "1" and nothing else. The id must be unique within the
-          ensemble and should have a value between 1 and 255. <emphasis role="bold">IMPORTANT:</emphasis> if you
-          enable extended features such as TTL Nodes (see below) the id must be
-          between 1 and 254 due to internal limitations.</para>
-        </listitem>
-
-        <listitem>
-          <para>Create an initialization marker file <filename>initialize</filename>
-            in the same directory as <filename>myid</filename>. This file indicates
-            that an empty data directory is expected. When present, an empty data base
-            is created and the marker file deleted. When not present, an empty data
-            directory will mean this peer will not have voting rights and it will not
-            populate the data directory until it communicates with an active leader.
-            Intended use is to only create this file when bringing up a new
-            ensemble. </para>
-        </listitem>
-        <listitem>
-          <para>If your configuration file is set up, you can start a
-          ZooKeeper server:</para>
-
-          <para><computeroutput>$ java -cp zookeeper.jar:lib/slf4j-api-1.7.5.jar:lib/slf4j-log4j12-1.7.5.jar:lib/log4j-1.2.17.jar:conf \
-              org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.cfg
-          </computeroutput></para>
-          
-          <para>QuorumPeerMain starts a ZooKeeper server,
-            <ulink url="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">JMX</ulink>
-            management beans are also registered which allows
-            management through a JMX management console. 
-            The <ulink url="zookeeperJMX.html">ZooKeeper JMX
-            document</ulink> contains details on managing ZooKeeper with JMX.
-          </para>
-
-          <para>See the script <emphasis>bin/zkServer.sh</emphasis>,
-            which is included in the release, for an example
-            of starting server instances.</para>
-
-        </listitem>
-
-        <listitem>
-          <para>Test your deployment by connecting to the hosts:</para>
-
-          <para>In Java, you can run the following command to execute
-          simple operations:</para>
-
-          <para><computeroutput>$ bin/zkCli.sh -server 127.0.0.1:2181</computeroutput></para>
-        </listitem>
-      </orderedlist>
-    </section>
-
-    <section id="sc_singleAndDevSetup">
-      <title>Single Server and Developer Setup</title>
-
-      <para>If you want to setup ZooKeeper for development purposes, you will
-      probably want to setup a single server instance of ZooKeeper, and then
-      install either the Java or C client-side libraries and bindings on your
-      development machine.</para>
-
-      <para>The steps to setting up a single server instance are the similar
-      to the above, except the configuration file is simpler. You can find the
-      complete instructions in the <ulink
-      url="zookeeperStarted.html#sc_InstallingSingleMode">Installing and
-      Running ZooKeeper in Single Server Mode</ulink> section of the <ulink
-      url="zookeeperStarted.html">ZooKeeper Getting Started
-      Guide</ulink>.</para>
-
-      <para>For information on installing the client side libraries, refer to
-      the <ulink url="zookeeperProgrammers.html#Bindings">Bindings</ulink>
-      section of the <ulink url="zookeeperProgrammers.html">ZooKeeper
-      Programmer's Guide</ulink>.</para>
-    </section>
-  </section>
-
-  <section id="ch_administration">
-    <title>Administration</title>
-
-    <para>This section contains information about running and maintaining
-    ZooKeeper and covers these topics: </para>
-    <itemizedlist>
-        <listitem>
-          <para><xref linkend="sc_designing" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_provisioning" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_strengthsAndLimitations" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_administering" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_maintenance" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_supervision" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_monitoring" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_logging" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_troubleshooting" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_configuration" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_zkCommands" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_dataFileManagement" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_commonProblems" /></para>
-        </listitem>
-
-        <listitem>
-          <para><xref linkend="sc_bestPractices" /></para>
-        </listitem>
-      </itemizedlist>
-
-    <section id="sc_designing">
-      <title>Designing a ZooKeeper Deployment</title>
-
-      <para>The reliability of ZooKeeper rests on two basic assumptions.</para>
-      <orderedlist>
-        <listitem><para> Only a minority of servers in a deployment
-            will fail. <emphasis>Failure</emphasis> in this context
-            means a machine crash, or some error in the network that
-            partitions a server off from the majority.</para>
-        </listitem>
-        <listitem><para> Deployed machines operate correctly. To
-            operate correctly means to execute code correctly, to have
-            clocks that work properly, and to have storage and network
-            components that perform consistently.</para>
-        </listitem>
-      </orderedlist>
-    
-    <para>The sections below contain considerations for ZooKeeper
-      administrators to maximize the probability for these assumptions
-      to hold true. Some of these are cross-machines considerations,
-      and others are things you should consider for each and every
-      machine in your deployment.</para>
-
-    <section id="sc_CrossMachineRequirements">
-      <title>Cross Machine Requirements</title>
-    
-      <para>For the ZooKeeper service to be active, there must be a
-        majority of non-failing machines that can communicate with
-        each other. To create a deployment that can tolerate the
-        failure of F machines, you should count on deploying 2xF+1
-        machines.  Thus, a deployment that consists of three machines
-        can handle one failure, and a deployment of five machines can
-        handle two failures. Note that a deployment of six machines
-        can only handle two failures since three machines is not a
-        majority.  For this reason, ZooKeeper deployments are usually
-        made up of an odd number of machines.</para>
-
-      <para>To achieve the highest probability of tolerating a failure
-        you should try to make machine failures independent. For
-        example, if most of the machines share the same switch,
-        failure of that switch could cause a correlated failure and
-        bring down the service. The same holds true of shared power
-        circuits, cooling systems, etc.</para>
-    </section>
-
-    <section>
-      <title>Single Machine Requirements</title>
-
-      <para>If ZooKeeper has to contend with other applications for
-        access to resources like storage media, CPU, network, or
-        memory, its performance will suffer markedly.  ZooKeeper has
-        strong durability guarantees, which means it uses storage
-        media to log changes before the operation responsible for the
-        change is allowed to complete. You should be aware of this
-        dependency then, and take great care if you want to ensure
-        that ZooKeeper operations aren’t held up by your media. Here
-        are some things you can do to minimize that sort of
-        degradation:
-      </para>
-
-      <itemizedlist>
-        <listitem>
-          <para>ZooKeeper's transaction log must be on a dedicated
-            device. (A dedicated partition is not enough.) ZooKeeper
-            writes the log sequentially, without seeking Sharing your
-            log device with other processes can cause seeks and
-            contention, which in turn can cause multi-second
-            delays.</para>
-        </listitem>
-
-        <listitem>
-          <para>Do not put ZooKeeper in a situation that can cause a
-            swap. In order for ZooKeeper to function with any sort of
-            timeliness, it simply cannot be allowed to swap.
-            Therefore, make certain that the maximum heap size given
-            to ZooKeeper is not bigger than the amount of real memory
-            available to ZooKeeper.  For more on this, see
-            <xref linkend="sc_commonProblems"/>
-            below. </para>
-        </listitem>
-      </itemizedlist>
-    </section>
-    </section>
-
-    <section id="sc_provisioning">
-      <title>Provisioning</title>
-
-      <para></para>
-    </section>
-
-    <section id="sc_strengthsAndLimitations">
-      <title>Things to Consider: ZooKeeper Strengths and Limitations</title>
-
-      <para></para>
-    </section>
-
-    <section id="sc_administering">
-      <title>Administering</title>
-
-      <para></para>
-    </section>
-
-    <section id="sc_maintenance">
-      <title>Maintenance</title>
-
-      <para>Little long term maintenance is required for a ZooKeeper
-        cluster however you must be aware of the following:</para>
-
-      <section>
-        <title>Ongoing Data Directory Cleanup</title>
-
-        <para>The ZooKeeper <ulink url="#var_datadir">Data
-          Directory</ulink> contains files which are a persistent copy
-          of the znodes stored by a particular serving ensemble. These
-          are the snapshot and transactional log files. As changes are
-          made to the znodes these changes are appended to a
-          transaction log. Occasionally, when a log grows large, a
-          snapshot of the current state of all znodes will be written
-          to the filesystem and a new transaction log file is created
-          for future transactions. During snapshotting, ZooKeeper may
-          continue appending incoming transactions to the old log file.
-          Therefore, some transactions which are newer than a snapshot
-          may be found in the last transaction log preceding the
-          snapshot.
-        </para>
-
-        <para>A ZooKeeper server <emphasis role="bold">will not remove
-        old snapshots and log files</emphasis> when using the default
-        configuration (see autopurge below), this is the
-        responsibility of the operator. Every serving environment is
-        different and therefore the requirements of managing these
-        files may differ from install to install (backup for example).
-        </para>
-
-        <para>The PurgeTxnLog utility implements a simple retention
-        policy that administrators can use. The <ulink
-        url="ext:api/index">API docs</ulink> contains details on
-        calling conventions (arguments, etc...).
-        </para>
-
-        <para>In the following example the last count snapshots and
-        their corresponding logs are retained and the others are
-        deleted.  The value of &lt;count&gt; should typically be
-        greater than 3 (although not required, this provides 3 backups
-        in the unlikely event a recent log has become corrupted). This
-        can be run as a cron job on the ZooKeeper server machines to
-        clean up the logs daily.</para>
-
-        <programlisting> java -cp zookeeper.jar:lib/slf4j-api-1.7.5.jar:lib/slf4j-log4j12-1.7.5.jar:lib/log4j-1.2.17.jar:conf org.apache.zookeeper.server.PurgeTxnLog &lt;dataDir&gt; &lt;snapDir&gt; -n &lt;count&gt;</programlisting>
-
-        <para>Automatic purging of the snapshots and corresponding
-        transaction logs was introduced in version 3.4.0 and can be
-        enabled via the following configuration parameters <emphasis
-        role="bold">autopurge.snapRetainCount</emphasis> and <emphasis
-        role="bold">autopurge.purgeInterval</emphasis>. For more on
-        this, see <xref linkend="sc_advancedConfiguration"/>
-        below.</para>
-      </section>
-
-      <section>
-        <title>Debug Log Cleanup (log4j)</title>
-
-        <para>See the section on <ulink
-        url="#sc_logging">logging</ulink> in this document. It is
-        expected that you will setup a rolling file appender using the
-        in-built log4j feature. The sample configuration file in the
-        release tar's conf/log4j.properties provides an example of
-        this.
-        </para>
-      </section>
-
-    </section>
-
-    <section id="sc_supervision">
-      <title>Supervision</title>
-
-      <para>You will want to have a supervisory process that manages
-      each of your ZooKeeper server processes (JVM). The ZK server is
-      designed to be "fail fast" meaning that it will shutdown
-      (process exit) if an error occurs that it cannot recover
-      from. As a ZooKeeper serving cluster is highly reliable, this
-      means that while the server may go down the cluster as a whole
-      is still active and serving requests. Additionally, as the
-      cluster is "self healing" the failed server once restarted will
-      automatically rejoin the ensemble w/o any manual
-      interaction.</para>
-
-      <para>Having a supervisory process such as <ulink
-      url="http://cr.yp.to/daemontools.html">daemontools</ulink> or
-      <ulink
-      url="http://en.wikipedia.org/wiki/Service_Management_Facility">SMF</ulink>
-      (other options for supervisory process are also available, it's
-      up to you which one you would like to use, these are just two
-      examples) managing your ZooKeeper server ensures that if the
-      process does exit abnormally it will automatically be restarted
-      and will quickly rejoin the cluster.</para>
-
-      <para>It is also recommended to configure the ZooKeeper server process to
-      terminate and dump its heap if an
-      <computeroutput>OutOfMemoryError</computeroutput> occurs.  This is achieved
-      by launching the JVM with the following arguments on Linux and Windows
-      respectively.  The <filename>zkServer.sh</filename> and
-      <filename>zkServer.cmd</filename> scripts that ship with ZooKeeper set
-      these options.
-      </para>
-
-      <programlisting>-XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError='kill -9 %p'</programlisting>
-      <programlisting>"-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f"</programlisting>
-    </section>
-
-    <section id="sc_monitoring">
-      <title>Monitoring</title>
-
-      <para>The ZooKeeper service can be monitored in one of two
-      primary ways; 1) the command port through the use of <ulink
-      url="#sc_zkCommands">4 letter words</ulink> and 2) <ulink
-      url="zookeeperJMX.html">JMX</ulink>. See the appropriate section for
-      your environment/requirements.</para>
-    </section>
-
-    <section id="sc_logging">
-      <title>Logging</title>
-
-    <para>
-        ZooKeeper uses <emphasis role="bold"><ulink url="http://www.slf4j.org">SLF4J</ulink></emphasis>
-        version 1.7.5 as its logging infrastructure. For backward compatibility it is bound to
-        <emphasis role="bold">LOG4J</emphasis> but you can use
-        <emphasis role="bold"><ulink url="http://logback.qos.ch/">LOGBack</ulink></emphasis>
-        or any other supported logging framework of your choice.
-    </para>
-    <para>
-        The ZooKeeper default <filename>log4j.properties</filename>
-        file resides in the <filename>conf</filename> directory. Log4j requires that
-        <filename>log4j.properties</filename> either be in the working directory
-        (the directory from which ZooKeeper is run) or be accessible from the classpath.
-    </para>
-
-    <para>For more information about SLF4J, see
-      <ulink url="http://www.slf4j.org/manual.html">its manual</ulink>.</para>
-
-    <para>For more information about LOG4J, see
-      <ulink url="http://logging.apache.org/log4j/1.2/manual.html#defaultInit">Log4j Default Initialization Procedure</ulink> 
-      of the log4j manual.</para>
-      
-    </section>
-
-    <section id="sc_troubleshooting">
-      <title>Troubleshooting</title>
-	<variablelist>
-		<varlistentry>
-		<term> Server not coming up because of file corruption</term>
-		<listitem>
-		<para>A server might not be able to read its database and fail to come up because of 
-		some file corruption in the transaction logs of the ZooKeeper server. You will
-		see some IOException on loading ZooKeeper database. In such a case,
-		make sure all the other servers in your ensemble are up and  working. Use "stat" 
-		command on the command port to see if they are in good health. After you have verified that
-		all the other servers of the ensemble are up, you can go ahead and clean the database
-		of the corrupt server. Delete all the files in datadir/version-2 and datalogdir/version-2/.
-		Restart the server.
-		</para>
-		</listitem>
-		</varlistentry>
-		</variablelist>
-    </section>
-
-    <section id="sc_configuration">
-      <title>Configuration Parameters</title>
-
-      <para>ZooKeeper's behavior is governed by the ZooKeeper configuration
-      file. This file is designed so that the exact same file can be used by
-      all the servers that make up a ZooKeeper server assuming the disk
-      layouts are the same. If servers use different configuration files, care
-      must be taken to ensure that the list of servers in all of the different
-      configuration files match.</para>
-
-      <note>
-        <para>In 3.5.0 and later, some of these parameters should be placed in
-         a dynamic configuration file. If they are placed in the static
-         configuration file, ZooKeeper will automatically move them over to the
-         dynamic configuration file. See <ulink url="zookeeperReconfig.html">
-         Dynamic Reconfiguration</ulink> for more information.</para>
-      </note>
-
-      <section id="sc_minimumConfiguration">
-        <title>Minimum Configuration</title>
-
-        <para>Here are the minimum configuration keywords that must be defined
-        in the configuration file:</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>clientPort</term>
-
-            <listitem>
-              <para>the port to listen for client connections; that is, the
-              port that clients attempt to connect to.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>secureClientPort</term>
-
-            <listitem>
-              <para>the port to listen on for secure client connections using SSL.
-
-              <emphasis role="bold">clientPort</emphasis> specifies
-                the port for plaintext connections while <emphasis role="bold">
-                  secureClientPort</emphasis> specifies the port for SSL
-                connections. Specifying both enables mixed-mode while omitting
-                either will disable that mode.</para>
-              <para>Note that SSL feature will be enabled when user plugs-in
-                zookeeper.serverCnxnFactory, zookeeper.clientCnxnSocket as Netty.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry id="var_datadir">
-            <term>dataDir</term>
-
-            <listitem>
-              <para>the location where ZooKeeper will store the in-memory
-              database snapshots and, unless specified otherwise, the
-              transaction log of updates to the database.</para>
-
-              <note>
-                <para>Be careful where you put the transaction log. A
-                dedicated transaction log device is key to consistent good
-                performance. Putting the log on a busy device will adversely
-                effect performance.</para>
-              </note>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry id="id_tickTime">
-            <term>tickTime</term>
-
-            <listitem>
-              <para>the length of a single tick, which is the basic time unit
-              used by ZooKeeper, as measured in milliseconds. It is used to
-              regulate heartbeats, and timeouts. For example, the minimum
-              session timeout will be two ticks.</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </section>
-
-      <section id="sc_advancedConfiguration">
-        <title>Advanced Configuration</title>
-
-        <para>The configuration settings in the section are optional. You can
-        use them to further fine tune the behaviour of your ZooKeeper servers.
-        Some can also be set using Java system properties, generally of the
-        form <emphasis>zookeeper.keyword</emphasis>. The exact system
-        property, when available, is noted below.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>dataLogDir</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>This option will direct the machine to write the
-              transaction log to the <emphasis
-              role="bold">dataLogDir</emphasis> rather than the <emphasis
-              role="bold">dataDir</emphasis>. This allows a dedicated log
-              device to be used, and helps avoid competition between logging
-              and snapshots.</para>
-
-              <note>
-                <para>Having a dedicated log device has a large impact on
-                throughput and stable latencies. It is highly recommended to
-                dedicate a log device and set <emphasis
-                role="bold">dataLogDir</emphasis> to point to a directory on
-                that device, and then make sure to point <emphasis
-                role="bold">dataDir</emphasis> to a directory
-                <emphasis>not</emphasis> residing on that device.</para>
-              </note>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>globalOutstandingLimit</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.globalOutstandingLimit.</emphasis>)</para>
-
-              <para>Clients can submit requests faster than ZooKeeper can
-              process them, especially if there are a lot of clients. To
-              prevent ZooKeeper from running out of memory due to queued
-              requests, ZooKeeper will throttle clients so that there is no
-              more than globalOutstandingLimit outstanding requests in the
-              system. The default limit is 1,000.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>preAllocSize</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.preAllocSize</emphasis>)</para>
-
-              <para>To avoid seeks ZooKeeper allocates space in the
-              transaction log file in blocks of preAllocSize kilobytes. The
-              default block size is 64M. One reason for changing the size of
-              the blocks is to reduce the block size if snapshots are taken
-              more often. (Also, see <emphasis
-              role="bold">snapCount</emphasis>).</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>snapCount</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.snapCount</emphasis>)</para>
-
-              <para>ZooKeeper records its transactions using snapshots and
-              a transaction log (think write-ahead log).The number of
-              transactions recorded in the transaction log before a snapshot
-              can be taken (and the transaction log rolled) is determined
-              by snapCount. In order to prevent all of the machines in the quorum
-              from taking a snapshot at the same time, each ZooKeeper server
-              will take a snapshot when the number of transactions in the transaction log
-              reaches a runtime generated random value in the [snapCount/2+1, snapCount] 
-              range.The default snapCount is 100,000.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>maxClientCnxns</term>
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Limits the number of concurrent connections (at the socket 
-              level) that a single client, identified by IP address, may make
-              to a single member of the ZooKeeper ensemble. This is used to 
-              prevent certain classes of DoS attacks, including file 
-              descriptor exhaustion. The default is 60. Setting this to 0
-              entirely removes the limit on concurrent connections.</para>
-            </listitem>
-           </varlistentry>
-
-           <varlistentry>
-             <term>clientPortAddress</term>
-
-             <listitem>
-               <para><emphasis role="bold">New in 3.3.0:</emphasis> the
-               address (ipv4, ipv6 or hostname) to listen for client
-               connections; that is, the address that clients attempt
-               to connect to. This is optional, by default we bind in
-               such a way that any connection to the <emphasis
-               role="bold">clientPort</emphasis> for any
-               address/interface/nic on the server will be
-               accepted.</para>
-             </listitem>
-           </varlistentry>
-
-          <varlistentry>
-            <term>minSessionTimeout</term>
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> the
-              minimum session timeout in milliseconds that the server
-              will allow the client to negotiate. Defaults to 2 times
-              the <emphasis role="bold">tickTime</emphasis>.</para>
-            </listitem>
-           </varlistentry>
-
-          <varlistentry>
-            <term>maxSessionTimeout</term>
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> the
-              maximum session timeout in milliseconds that the server
-              will allow the client to negotiate. Defaults to 20 times
-              the <emphasis role="bold">tickTime</emphasis>.</para>
-            </listitem>
-           </varlistentry>
-           
-           <varlistentry>
-             <term>fsync.warningthresholdms</term>
-             <listitem>
-               <para>(Java system property: <emphasis
-               role="bold">zookeeper.fsync.warningthresholdms</emphasis>)</para>
-
-               <para><emphasis role="bold">New in 3.3.4:</emphasis> A
-               warning message will be output to the log whenever an
-               fsync in the Transactional Log (WAL) takes longer than
-               this value. The values is specified in milliseconds and
-               defaults to 1000. This value can only be set as a
-               system property.</para>
-             </listitem>
-           </varlistentry>
-
-          <varlistentry>
-            <term>autopurge.snapRetainCount</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.4.0:</emphasis> 
-              When enabled, ZooKeeper auto purge feature retains
-              the <emphasis role="bold">autopurge.snapRetainCount</emphasis> most
-              recent snapshots and the corresponding transaction logs in the 
-              <emphasis role="bold">dataDir</emphasis> and <emphasis 
-              role="bold">dataLogDir</emphasis> respectively and deletes the rest.
-              Defaults to 3. Minimum value is 3.</para>
-            </listitem>
-          </varlistentry>
-          
-          <varlistentry>
-            <term>autopurge.purgeInterval</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.4.0:</emphasis> The
-              time interval in hours for which the purge task has to
-              be triggered. Set to a positive integer (1 and above)
-              to enable the auto purging. Defaults to 0.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>syncEnabled</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.observer.syncEnabled</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.4.6, 3.5.0:</emphasis>
-              The observers now log transaction and write snapshot to disk
-              by default like the participants. This reduces the recovery time
-              of the observers on restart. Set to "false" to disable this
-              feature. Default is "true"</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>zookeeper.extendedTypesEnabled</term>
-
-            <listitem>
-                <para>(Java system property only: <emphasis
-                    role="bold">zookeeper.extendedTypesEnabled</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.5.4, 3.6.0:</emphasis> Define to "true" to enable
-              extended features such as the creation of <ulink url="zookeeperProgrammers.html#TTL+Nodes">TTL Nodes</ulink>.
-              They are disabled by default. IMPORTANT: when enabled server IDs must
-              be less than 255 due to internal limitations.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>zookeeper.emulate353TTLNodes</term>
-
-            <listitem>
-                <para>(Java system property only: <emphasis
-                    role="bold">zookeeper.emulate353TTLNodes</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.5.4, 3.6.0:</emphasis> Due to
-                <ulink url="https://issues.apache.org/jira/browse/ZOOKEEPER-2901">ZOOKEEPER-2901</ulink> TTL nodes
-                created in version 3.5.3 are not supported in 3.5.4/3.6.0. However, a workaround is provided via the
-                zookeeper.emulate353TTLNodes system property. If you used TTL nodes in ZooKeeper 3.5.3 and need to maintain
-                compatibility set <emphasis role="bold">zookeeper.emulate353TTLNodes</emphasis> to "true" in addition to
-                <emphasis role="bold">zookeeper.extendedTypesEnabled</emphasis>. NOTE: due to the bug, server IDs
-                must be 127 or less. Additionally, the maximum support TTL value is 1099511627775 which is smaller
-                than what was allowed in 3.5.3 (1152921504606846975)</para>
-            </listitem>
-          </varlistentry>
-
-        </variablelist>
-      </section>
-
-      <section id="sc_clusterOptions">
-        <title>Cluster Options</title>
-
-        <para>The options in this section are designed for use with an ensemble
-        of servers -- that is, when deploying clusters of servers.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>electionAlg</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Election implementation to use. A value of "1" corresponds to the
-              non-authenticated UDP-based version of fast leader election, "2"
-              corresponds to the authenticated UDP-based version of fast
-              leader election, and "3" corresponds to TCP-based version of
-              fast leader election. Currently, algorithm 3 is the default.</para>
-              
-              <note>
-              <para> The implementations of leader election 1, and 2 are now
-              <emphasis role="bold"> deprecated </emphasis>. We have the intention
-              of removing them in the next release, at which point only the 
-              FastLeaderElection will be available. 
-              </para>
-              </note>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>initLimit</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Amount of time, in ticks (see <ulink
-              url="#id_tickTime">tickTime</ulink>), to allow followers to
-              connect and sync to a leader. Increased this value as needed, if
-              the amount of data managed by ZooKeeper is large.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>leaderServes</term>
-
-            <listitem>
-              <para>(Java system property: zookeeper.<emphasis
-              role="bold">leaderServes</emphasis>)</para>
-
-              <para>Leader accepts client connections. Default value is "yes".
-              The leader machine coordinates updates. For higher update
-              throughput at the slight expense of read throughput the leader
-              can be configured to not accept clients and focus on
-              coordination. The default to this option is yes, which means
-              that a leader will accept client connections.</para>
-
-              <note>
-                <para>Turning on leader selection is highly recommended when
-                you have more than three ZooKeeper servers in an ensemble.</para>
-              </note>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>server.x=[hostname]:nnnnn[:nnnnn], etc</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>servers making up the ZooKeeper ensemble. When the server
-              starts up, it determines which server it is by looking for the
-              file <filename>myid</filename> in the data directory. That file
-              contains the server number, in ASCII, and it should match
-              <emphasis role="bold">x</emphasis> in <emphasis
-              role="bold">server.x</emphasis> in the left hand side of this
-              setting.</para>
-
-              <para>The list of servers that make up ZooKeeper servers that is
-              used by the clients must match the list of ZooKeeper servers
-              that each ZooKeeper server has.</para>
-
-              <para>There are two port numbers <emphasis role="bold">nnnnn</emphasis>. 
-              The first followers use to connect to the leader, and the second is for 
-              leader election. If you want to test multiple servers on a single machine, then
-              different ports can be used for each server.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>syncLimit</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Amount of time, in ticks (see <ulink
-              url="#id_tickTime">tickTime</ulink>), to allow followers to sync
-              with ZooKeeper. If followers fall too far behind a leader, they
-              will be dropped.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>group.x=nnnnn[:nnnnn]</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Enables a hierarchical quorum construction."x" is a group identifier
-              and the numbers following the "=" sign correspond to server identifiers. 
-              The left-hand side of the assignment is a colon-separated list of server
-              identifiers. Note that groups must be disjoint and the union of all groups
-              must be the ZooKeeper ensemble. </para>
-              
-              <para> You will find an example <ulink url="zookeeperHierarchicalQuorums.html">here</ulink>
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>weight.x=nnnnn</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para>Used along with "group", it assigns a weight to a server when
-              forming quorums. Such a value corresponds to the weight of a server
-              when voting. There are a few parts of ZooKeeper that require voting
-              such as leader election and the atomic broadcast protocol. By default
-              the weight of server is 1. If the configuration defines groups, but not
-              weights, then a value of 1 will be assigned to all servers.  
-              </para>
-              
-              <para> You will find an example <ulink url="zookeeperHierarchicalQuorums.html">here</ulink>
-              </para>
-            </listitem>
-          </varlistentry>
-          
-          <varlistentry>
-            <term>cnxTimeout</term>
-
-            <listitem>
-              <para>(Java system property: zookeeper.<emphasis
-              role="bold">cnxTimeout</emphasis>)</para>
-
-              <para>Sets the timeout value for opening connections for leader election notifications. 
-              Only applicable if you are using electionAlg 3. 
-              </para>
-
-              <note>
-                <para>Default value is 5 seconds.</para>
-              </note>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>standaloneEnabled</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.5.0:</emphasis>
-              When set to false, a single server can be started in replicated
-              mode, a lone participant can run with observers, and a cluster
-              can reconfigure down to one node, and up from one node. The
-              default is true for backwards compatibility. It can be set
-              using QuorumPeerConfig's setStandaloneEnabled method or by
-              adding "standaloneEnabled=false" or "standaloneEnabled=true"
-              to a server's config file.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>reconfigEnabled</term>
-
-            <listitem>
-              <para>(No Java system property)</para>
-
-              <para><emphasis role="bold">New in 3.5.3:</emphasis>
-                This controls the enabling or disabling of
-                <ulink url="zookeeperReconfig.html">
-                  Dynamic Reconfiguration</ulink> feature. When the feature
-                is enabled, users can perform reconfigure operations through
-                the ZooKeeper client API or through ZooKeeper command line tools
-                assuming users are authorized to perform such operations.
-                When the feature is disabled, no user, including the super user,
-                can perform a reconfiguration. Any attempt to reconfigure will return an error.
-                <emphasis role="bold">"reconfigEnabled"</emphasis> option can be set as
-                <emphasis role="bold">"reconfigEnabled=false"</emphasis> or
-                <emphasis role="bold">"reconfigEnabled=true"</emphasis>
-                to a server's config file, or using QuorumPeerConfig's
-                setReconfigEnabled method. The default value is false.
-
-                If present, the value should be consistent across every server in
-                the entire ensemble. Setting the value as true on some servers and false
-                on other servers will cause inconsistent behavior depending on which server
-                is elected as leader. If the leader has a setting of
-                <emphasis role="bold">"reconfigEnabled=true"</emphasis>, then the ensemble
-                will have reconfig feature enabled. If the leader has a setting of
-                <emphasis role="bold">"reconfigEnabled=false"</emphasis>, then the ensemble
-                will have reconfig feature disabled. It is thus recommended to have a consistent
-                value for <emphasis role="bold">"reconfigEnabled"</emphasis> across servers
-                in the ensemble.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>4lw.commands.whitelist</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-                      role="bold">zookeeper.4lw.commands.whitelist</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.5.3:</emphasis>
-                A list of comma separated <ulink url="#sc_4lw">Four Letter Words</ulink>
-                commands that user wants to use. A valid Four Letter Words
-                command must be put in this list else ZooKeeper server will
-                not enable the command.
-                By default the whitelist only contains "srvr" command
-                which zkServer.sh uses. The rest of four letter word commands are disabled
-                by default.
-              </para>
-
-              <para>Here's an example of the configuration that enables stat, ruok, conf, and isro
-              command while disabling the rest of Four Letter Words command:</para>
-              <programlisting>
-                4lw.commands.whitelist=stat, ruok, conf, isro
-              </programlisting>
-
-              <para>If you really need enable all four letter word commands by default, you can use
-                the asterisk option so you don't have to include every command one by one in the list.
-                As an example, this will enable all four letter word commands:
-              </para>
-              <programlisting>
-                4lw.commands.whitelist=*
-              </programlisting>
-
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>tcpKeepAlive</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-                      role="bold">zookeeper.tcpKeepAlive</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.5.4:</emphasis>
-                Setting this to true sets the TCP keepAlive flag on the
-                sockets used by quorum members to perform elections.
-                This will allow for connections between quorum members to
-                remain up when there is network infrastructure that may
-                otherwise break them. Some NATs and firewalls may terminate
-                or lose state for long running or idle connections.</para>
-
-              <para> Enabling this option relies on OS level settings to work
-                properly, check your operating system's options regarding TCP
-                keepalive for more information.  Defaults to
-                <emphasis role="bold">false</emphasis>.
-              </para>
-            </listitem>
-          </varlistentry>
-
-        </variablelist>
-        <para></para>
-      </section>
-
-      <section id="sc_authOptions">
-        <title>Encryption, Authentication, Authorization Options</title>
-
-        <para>The options in this section allow control over
-        encryption/authentication/authorization performed by the service.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>DigestAuthenticationProvider.superDigest</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.DigestAuthenticationProvider.superDigest</emphasis>)</para>
-
-              <para>By default this feature is <emphasis
-              role="bold">disabled</emphasis></para>
-
-              <para><emphasis role="bold">New in 3.2:</emphasis>
-              Enables a ZooKeeper ensemble administrator to access the
-              znode hierarchy as a "super" user. In particular no ACL
-              checking occurs for a user authenticated as
-              super.</para>
-
-              <para>org.apache.zookeeper.server.auth.DigestAuthenticationProvider
-              can be used to generate the superDigest, call it with
-              one parameter of "super:&lt;password>". Provide the
-              generated "super:&lt;data>" as the system property value
-              when starting each server of the ensemble.</para>
-
-              <para>When authenticating to a ZooKeeper server (from a
-              ZooKeeper client) pass a scheme of "digest" and authdata
-              of "super:&lt;password>". Note that digest auth passes
-              the authdata in plaintext to the server, it would be
-              prudent to use this authentication method only on
-              localhost (not over the network) or over an encrypted
-              connection.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>X509AuthenticationProvider.superUser</term>
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.X509AuthenticationProvider.superUser</emphasis>)</para>
-
-              <para>The SSL-backed way to enable a ZooKeeper ensemble
-              administrator to access the znode hierarchy as a "super" user.
-              When this parameter is set to an X500 principal name, only an
-              authenticated client with that principal will be able to bypass
-              ACL checking and have full privileges to all znodes.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>zookeeper.superUser</term>
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.superUser</emphasis>)</para>
-
-              <para>Similar to <emphasis role="bold">zookeeper.X509AuthenticationProvider.superUser</emphasis>
-              but is generic for SASL based logins. It stores the name of 
-              a user that can access the znode hierarchy as a "super" user.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>ssl.keyStore.location and ssl.keyStore.password</term>
-            <listitem>
-              <para>(Java system properties: <emphasis role="bold">
-                zookeeper.ssl.keyStore.location</emphasis> and <emphasis
-                      role="bold">zookeeper.ssl.keyStore.password</emphasis>)</para>
-
-              <para>Specifies the file path to a JKS containing the local
-                credentials to be used for SSL connections, and the
-                password to unlock the file.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>ssl.trustStore.location and ssl.trustStore.password</term>
-            <listitem>
-              <para>(Java system properties: <emphasis role="bold">
-                zookeeper.ssl.trustStore.location</emphasis> and <emphasis
-                      role="bold">zookeeper.ssl.trustStore.password</emphasis>)</para>
-
-              <para>Specifies the file path to a JKS containing the remote
-                credentials to be used for SSL connections, and the
-                password to unlock the file.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>ssl.authProvider</term>
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.ssl.authProvider</emphasis>)</para>
-
-              <para>Specifies a subclass of <emphasis role="bold">
-              org.apache.zookeeper.auth.X509AuthenticationProvider</emphasis>
-              to use for secure client authentication. This is useful in
-              certificate key infrastructures that do not use JKS. It may be
-              necessary to extend <emphasis role="bold">javax.net.ssl.X509KeyManager
-              </emphasis> and <emphasis role="bold">javax.net.ssl.X509TrustManager</emphasis>
-              to get the desired behavior from the SSL stack. To configure the
-              ZooKeeper server to use the custom provider for authentication,
-              choose a scheme name for the custom AuthenticationProvider and
-              set the property <emphasis role="bold">zookeeper.authProvider.[scheme]
-              </emphasis> to the fully-qualified class name of the custom
-              implementation. This will load the provider into the ProviderRegistry.
-              Then set this property <emphasis role="bold">
-              zookeeper.ssl.authProvider=[scheme]</emphasis> and that provider
-              will be used for secure authentication.</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </section>
-
-      <section>
-        <title>Experimental Options/Features</title>
-
-        <para>New features that are currently considered experimental.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>Read Only Mode Server</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">readonlymode.enabled</emphasis>)</para>
-
-              <para><emphasis role="bold">New in 3.4.0:</emphasis>
-              Setting this value to true enables Read Only Mode server
-              support (disabled by default). ROM allows clients
-              sessions which requested ROM support to connect to the
-              server even when the server might be partitioned from
-              the quorum. In this mode ROM clients can still read
-              values from the ZK service, but will be unable to write
-              values and see changes from other clients. See
-              ZOOKEEPER-784 for more details.
-              </para>
-            </listitem>
-          </varlistentry>
-
-        </variablelist>
-      </section>
-
-      <section>
-        <title>Unsafe Options</title>
-
-        <para>The following options can be useful, but be careful when you use
-        them. The risk of each is explained along with the explanation of what
-        the variable does.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>forceSync</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.forceSync</emphasis>)</para>
-
-              <para>Requires updates to be synced to media of the transaction
-              log before finishing processing the update. If this option is
-              set to no, ZooKeeper will not require updates to be synced to
-              the media.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>jute.maxbuffer:</term>
-
-            <listitem>
-              <para>(Java system property:<emphasis role="bold">
-              jute.maxbuffer</emphasis>)</para>
-
-              <para>This option can only be set as a Java system property.
-              There is no zookeeper prefix on it. It specifies the maximum
-              size of the data that can be stored in a znode. The default is
-              0xfffff, or just under 1M. If this option is changed, the system
-              property must be set on all servers and clients otherwise
-              problems will arise. This is really a sanity check. ZooKeeper is
-              designed to store data on the order of kilobytes in size.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>skipACL</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.skipACL</emphasis>)</para>
-
-              <para>Skips ACL checks. This results in a boost in throughput,
-              but opens up full access to the data tree to everyone.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>quorumListenOnAllIPs</term>
-
-            <listitem>
-              <para>When set to true the ZooKeeper server will listen  
-              for connections from its peers on all available IP addresses,
-              and not only the address configured in the server list of the
-              configuration file. It affects the connections handling the 
-              ZAB protocol and the Fast Leader Election protocol. Default
-              value is <emphasis role="bold">false</emphasis>.</para>
-            </listitem>
-          </varlistentry>
-
-        </variablelist>
-      </section>
-
-      <section>
-        <title>Disabling data directory autocreation</title>
-
-        <para><emphasis role="bold">New in 3.5:</emphasis> The default
-        behavior of a ZooKeeper server is to automatically create the
-        data directory (specified in the configuration file) when
-        started if that directory does not already exist. This can be
-        inconvenient and even dangerous in some cases. Take the case
-        where a configuration change is made to a running server,
-        wherein the <emphasis role="bold">dataDir</emphasis> parameter
-        is accidentally changed. When the ZooKeeper server is
-        restarted it will create this non-existent directory and begin
-        serving - with an empty znode namespace. This scenario can
-        result in an effective "split brain" situation (i.e. data in
-        both the new invalid directory and the original valid data
-        store). As such is would be good to have an option to turn off
-        this autocreate behavior. In general for production
-        environments this should be done, unfortunately however the
-        default legacy behavior cannot be changed at this point and
-        therefore this must be done on a case by case basis. This is
-        left to users and to packagers of ZooKeeper distributions.
-        </para>
-
-        <para>When running <emphasis
-        role="bold">zkServer.sh</emphasis> autocreate can be disabled
-        by setting the environment variable <emphasis
-        role="bold">ZOO_DATADIR_AUTOCREATE_DISABLE</emphasis> to 1.
-        When running ZooKeeper servers directly from class files this
-        can be accomplished by setting <emphasis
-        role="bold">zookeeper.datadir.autocreate=false</emphasis> on
-        the java command line, i.e. <emphasis
-        role="bold">-Dzookeeper.datadir.autocreate=false</emphasis>
-        </para>
-
-        <para>When this feature is disabled, and the ZooKeeper server
-        determines that the required directories do not exist it will
-        generate an error and refuse to start.
-        </para>
-
-        <para>A new script <emphasis
-        role="bold">zkServer-initialize.sh</emphasis> is provided to
-        support this new feature. If autocreate is disabled it is
-        necessary for the user to first install ZooKeeper, then create
-        the data directory (and potentially txnlog directory), and
-        then start the server. Otherwise as mentioned in the previous
-        paragraph the server will not start. Running <emphasis
-        role="bold">zkServer-initialize.sh</emphasis> will create the
-        required directories, and optionally setup the myid file
-        (optional command line parameter). This script can be used
-        even if the autocreate feature itself is not used, and will
-        likely be of use to users as this (setup, including creation
-        of the myid file) has been an issue for users in the past.
-        Note that this script ensures the data directories exist only,
-        it does not create a config file, but rather requires a config
-        file to be available in order to execute.
-        </para>
-      </section>
-
-      <section id="sc_db_existence_validation">
-        <title>Enabling db existence validation</title>
-
-        <para><emphasis role="bold">New in 3.6.0:</emphasis> The default
-          behavior of a ZooKeeper server on startup when no data tree
-          is found is to set zxid to zero and join the quorum as a
-          voting member. This can be dangerous if some event (e.g. a
-          rogue 'rm -rf') has removed the data directory while the
-          server was down since this server may help elect a leader
-          that is missing transactions. Enabling db existence validation
-          will change the behavior on startup when no data tree is
-          found: the server joins the ensemble as a non-voting participant
-          until it is able to sync with the leader and acquire an up-to-date
-          version of the ensemble data. To indicate an empty data tree is
-          expected (ensemble creation), the user should place a file
-          'initialize' in the same directory as 'myid'. This file will
-          be detected and deleted by the server on startup.
-        </para>
-
-        <para> Initialization validation can be enabled when running
-          ZooKeeper servers directly from class files by setting
-          <emphasis role="bold">zookeeper.db.autocreate=false</emphasis>
-          on the java command line, i.e.
-          <emphasis role="bold">-Dzookeeper.db.autocreate=false</emphasis>.
-          Running <emphasis role="bold">zkServer-initialize.sh</emphasis>
-          will create the required initialization file.
-        </para>
-      </section>
-
-      <section id="sc_performance_options">
-        <title>Performance Tuning Options</title>
-
-        <para><emphasis role="bold">New in 3.5.0:</emphasis> Several subsystems have been reworked
-        to improve read throughput. This includes multi-threading of the NIO communication subsystem and
-        request processing pipeline (Commit Processor). NIO is the default client/server communication
-        subsystem. Its threading model comprises 1 acceptor thread, 1-N selector threads and 0-M
-        socket I/O worker threads. In the request processing pipeline the system can be configured
-        to process multiple read request at once while maintaining the same consistency guarantee
-        (same-session read-after-write). The Commit Processor threading model comprises 1 main
-        thread and 0-N worker threads.
-        </para>
-
-        <para>
-        The default values are aimed at maximizing read throughput on a dedicated ZooKeeper machine.
-        Both subsystems need to have sufficient amount of threads to achieve peak read throughput.
-        </para>
-
-        <variablelist>
-
-          <varlistentry>
-            <term>zookeeper.nio.numSelectorThreads</term>
-            <listitem>
-              <para>(Java system property only: <emphasis
-              role="bold">zookeeper.nio.numSelectorThreads</emphasis>)
-              </para>
-              <para><emphasis role="bold">New in 3.5.0:</emphasis>
-              Number of NIO selector threads. At least 1 selector thread required.
-              It is recommended to use more than one selector for large numbers
-              of client connections. The default value is sqrt( number of cpu cores / 2 ).
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>zookeeper.nio.numWorkerThreads</term>
-            <listitem>
-              <para>(Java system property only: <emphasis
-              role="bold">zookeeper.nio.numWorkerThreads</emphasis>)
-              </para>
-              <para><emphasis role="bold">New in 3.5.0:</emphasis>
-              Number of NIO worker threads. If configured with 0 worker threads, the selector threads
-              do the socket I/O directly. The default value is 2 times the number of cpu cores.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>zookeeper.commitProcessor.numWorkerThreads</term>
-            <listitem>
-              <para>(Java system property only: <emphasis
-              role="bold">zookeeper.commitProcessor.numWorkerThreads</emphasis>)
-              </para>
-              <para><emphasis role="bold">New in 3.5.0:</emphasis>
-              Number of Commit Processor worker threads. If configured with 0 worker threads, the main thread
-              will process the request directly. The default value is the number of cpu cores.
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>znode.container.checkIntervalMs</term>
-
-            <listitem>
-              <para>(Java system property only)</para>
-
-              <para><emphasis role="bold">New in 3.6.0:</emphasis> The
-                time interval in milliseconds for each check of candidate container
-                and ttl nodes. Default is "60000".</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>znode.container.maxPerMinute</term>
-
-            <listitem>
-              <para>(Java system property only)</para>
-
-              <para><emphasis role="bold">New in 3.6.0:</emphasis> The
-                maximum number of container and ttl nodes that can be deleted per
-                minute. This prevents herding during container deletion.
-                Default is "10000".</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </section>
-
-      <section>
-        <title>Communication using the Netty framework</title>
-
-        <para><ulink url="http://netty.io">Netty</ulink>
-            is an NIO based client/server communication framework, it
-            simplifies (over NIO being used directly) many of the
-            complexities of network level communication for java
-            applications. Additionally the Netty framework has built
-            in support for encryption (SSL) and authentication
-            (certificates). These are optional features and can be
-            turned on or off individually.
-        </para>
-        <para>In versions 3.5+, a ZooKeeper server can use Netty
-            instead of NIO (default option) by setting the environment
-            variable <emphasis role="bold">zookeeper.serverCnxnFactory</emphasis>
-            to <emphasis role="bold">org.apache.zookeeper.server.NettyServerCnxnFactory</emphasis>;
-            for the client, set <emphasis role="bold">zookeeper.clientCnxnSocket</emphasis>
-            to <emphasis role="bold">org.apache.zookeeper.ClientCnxnSocketNetty</emphasis>.
-        </para>
-
-        <para>
-          TBD - tuning options for netty - currently there are none that are netty specific but we should add some. Esp around max bound on the number of reader worker threads netty creates.
-        </para>
-        <para>
-          TBD - how to manage encryption
-        </para>
-        <para>
-          TBD - how to manage certificates
-        </para>
-
-      </section>
-
-      <section id="sc_adminserver_config">
-        <title>AdminServer configuration</title>
-        <para><emphasis role="bold">New in 3.5.0:</emphasis> The following
-        options are used to configure the <ulink
-        url="#sc_adminserver">AdminServer</ulink>.</para>
-
-        <variablelist>
-          <varlistentry>
-            <term>admin.enableServer</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.admin.enableServer</emphasis>)</para>
-
-              <para>Set to "false" to disable the AdminServer.  By default the
-              AdminServer is enabled.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>admin.serverAddress</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.admin.serverAddress</emphasis>)</para>
-
-              <para>The address the embedded Jetty server listens on. Defaults to 0.0.0.0.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>admin.serverPort</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.admin.serverPort</emphasis>)</para>
-
-              <para>The port the embedded Jetty server listens on.  Defaults to 8080.</para>
-            </listitem>
-          </varlistentry>
-
-            <varlistentry>
-                <term>admin.idleTimeout</term>
-
-                <listitem>
-                    <para>(Java system property: <emphasis
-                            role="bold">zookeeper.admin.idleTimeout</emphasis>)</para>
-
-                    <para>Set the maximum idle time in milliseconds that a connection can wait 
-                          before sending or receiving data. Defaults to 30000 ms.</para>
-                </listitem>
-            </varlistentry>
-
-
-          <varlistentry>
-            <term>admin.commandURL</term>
-
-            <listitem>
-              <para>(Java system property: <emphasis
-              role="bold">zookeeper.admin.commandURL</emphasis>)</para>
-
-              <para>The URL for listing and issuing commands relative to the
-              root URL.  Defaults to "/commands".</para>
-            </listitem>
-          </varlistentry>
-        </variablelist>
-      </section>
-
-    </section>
-
-    <section id="sc_zkCommands">
-      <title>ZooKeeper Commands</title>
-
-      <section id="sc_4lw">
-        <title>The Four Letter Words</title>
-        <para>ZooKeeper responds to a small set of commands. Each command is
-        composed of four letters. You issue the commands to ZooKeeper via telnet
-        or nc, at the client port.</para>
-
-        <para>Three of the more interesting commands: "stat" gives some
-        general information about the server and connected clients,
-        while "srvr" and "cons" give extended details on server and
-        connections respectively.</para>
-
-        <para><emphasis role="bold">New in 3.5.3:</emphasis>
-          Four Letter Words need to be explicitly white listed before using.
-          Please refer <emphasis role="bold">4lw.commands.whitelist</emphasis>
-           described in <ulink url="#sc_clusterOptions">
-            cluster configuration section</ulink> for details.
-          Moving forward, Four Letter Words will be deprecated, please use
-          <ulink url="#sc_adminserver">AdminServer</ulink> instead.
-        </para>
-
-      <variablelist>
-          <varlistentry>
-            <term>conf</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Print
-              details about serving configuration.</para>
-            </listitem>
-
-          </varlistentry>
-
-          <varlistentry>
-            <term>cons</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> List
-              full connection/session details for all clients connected
-              to this server. Includes information on numbers of packets
-              received/sent, session id, operation latencies, last
-              operation performed, etc...</para>
-            </listitem>
-
-          </varlistentry>
-
-          <varlistentry>
-            <term>crst</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Reset
-              connection/session statistics for all connections.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>dump</term>
-
-            <listitem>
-              <para>Lists the outstanding sessions and ephemeral nodes. This
-              only works on the leader.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>envi</term>
-
-            <listitem>
-              <para>Print details about serving environment</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>ruok</term>
-
-            <listitem>
-              <para>Tests if server is running in a non-error state. The server
-              will respond with imok if it is running. Otherwise it will not
-              respond at all.</para>
-
-              <para>A response of "imok" does not necessarily indicate that the
-              server has joined the quorum, just that the server process is active
-              and bound to the specified client port. Use "stat" for details on
-              state wrt quorum and client connection information.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>srst</term>
-
-            <listitem>
-              <para>Reset server statistics.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>srvr</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
-              full details for the server.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>stat</term>
-
-            <listitem>
-              <para>Lists brief details for the server and connected
-              clients.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>wchs</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
-              brief information on watches for the server.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>wchc</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
-              detailed information on watches for the server, by
-              session.  This outputs a list of sessions(connections)
-              with associated watches (paths). Note, depending on the
-              number of watches this operation may be expensive (ie
-              impact server performance), use it carefully.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>dirs</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.5.1:</emphasis>
-                Shows the total size of snapshot and log files in bytes
-              </para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>wchp</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
-              detailed information on watches for the server, by path.
-              This outputs a list of paths (znodes) with associated
-              sessions. Note, depending on the number of watches this
-              operation may be expensive (ie impact server performance),
-              use it carefully.</para>
-            </listitem>
-          </varlistentry>
-
-
-          <varlistentry>
-            <term>mntr</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.4.0:</emphasis> Outputs a list 
-              of variables that could be used for monitoring the health of the cluster.</para>
-
-              <programlisting>$ echo mntr | nc localhost 2185
-
-              zk_version  3.4.0
-              zk_avg_latency  0
-              zk_max_latency  0
-              zk_min_latency  0
-              zk_packets_received 70
-              zk_packets_sent 69
-              zk_num_alive_connections	1
-              zk_outstanding_requests 0
-              zk_server_state leader
-              zk_znode_count   4
-              zk_watch_count  0
-              zk_ephemerals_count 0
-              zk_approximate_data_size    27
-              zk_followers    4                   - only exposed by the Leader
-              zk_synced_followers 4               - only exposed by the Leader
-              zk_pending_syncs    0               - only exposed by the Leader
-              zk_open_file_descriptor_count 23    - only available on Unix platforms
-              zk_max_file_descriptor_count 1024   - only available on Unix platforms
-              </programlisting>
-
-              <para>The output is compatible with java properties format and the content 
-              may change over time (new keys added). Your scripts should expect changes.</para>
-
-              <para>ATTENTION: Some of the keys are platform specific and some of the keys are only exported by the Leader. </para>
-
-              <para>The output contains multiple lines with the following format:</para>
-              <programlisting>key \t value</programlisting>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>isro</term>
-
-            <listitem>
-              <para><emphasis role="bold">New in 3.4.0:</emphasis> Tests if
-              server is running in read-only mode.  The server will respond with
-              "ro" if in read-only mode or "rw" if not in read-only mode.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>gtmk</term>
-
-            <listitem>
-              <para>Gets the current trace mask as a 64-bit signed long value in
-              decimal format.  See <command>stmk</command> for an explanation of
-              the possible values.</para>
-            </listitem>
-          </varlistentry>
-
-          <varlistentry>
-            <term>stmk</term>
-
-            <listitem>
-              <para>Sets the current trace mask.  The trace mask is 64 bits,
-              where each bit enables or disables a specific category of trace
-              logging on the server.  Log4J must be configured to enable
-              <command>TRACE</command> level first in order to see trace logging
-              messages.  The bits of the trace mask correspond to the following
-              trace logging categories.</para>
-
-              <table>
-                <title>Trace Mask Bit Values</title>
-                <tgroup cols="2" align="left" colsep="1" rowsep="1">
-                  <tbody>
-                    <row>
-                      <entry>0b0000000000</entry>
-                      <entry>Unused, reserved for future use.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0000000010</entry>
-                      <entry>Logs client requests, excluding ping
-                      requests.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0000000100</entry>
-                      <entry>Unused, reserved for future use.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0000001000</entry>
-                      <entry>Logs client ping requests.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0000010000</entry>
-                      <entry>Logs packets received from the quorum peer that is
-                      the current leader, excluding ping requests.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0000100000</entry>
-                      <entry>Logs addition, removal and validation of client
-                      sessions.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0001000000</entry>
-                      <entry>Logs delivery of watch events to client
-                      sessions.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0010000000</entry>
-                      <entry>Logs ping packets received from the quorum peer
-                      that is the current leader.</entry>
-                    </row>
-                    <row>
-                      <entry>0b0100000000</entry>
-                      <entry>Unused, reserved for future use.</entry>
-                    </row>
-                    <row>
-           

<TRUNCATED>

[12/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/recipes.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/recipes.xml b/src/docs/src/documentation/content/xdocs/recipes.xml
deleted file mode 100644
index f53536f..0000000
--- a/src/docs/src/documentation/content/xdocs/recipes.xml
+++ /dev/null
@@ -1,688 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="ar_Recipes">
-  <title>ZooKeeper Recipes and Solutions</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This guide contains pseudocode and guidelines for using Zookeeper to
-      solve common problems in Distributed Application Coordination. It
-      discusses such problems as event handlers, queues, and locks..</para>
-
-      <para>$Revision: 1.6 $ $Date: 2008/09/19 03:46:18 $</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_recipes">
-    <title>A Guide to Creating Higher-level Constructs with ZooKeeper</title>
-
-    <para>In this article, you'll find guidelines for using
-    ZooKeeper to implement higher order functions. All of them are conventions
-    implemented at the client and do not require special support from
-    ZooKeeper. Hopfully the community will capture these conventions in client-side libraries 
-    to ease their use and to encourage standardization.</para>
-
-    <para>One of the most interesting things about ZooKeeper is that even
-    though ZooKeeper uses <emphasis>asynchronous</emphasis> notifications, you
-    can use it to build <emphasis>synchronous</emphasis> consistency
-    primitives, such as queues and locks. As you will see, this is possible
-    because ZooKeeper imposes an overall order on updates, and has mechanisms
-    to expose this ordering.</para>
-
-    <para>Note that the recipes below attempt to employ best practices. In
-    particular, they avoid polling, timers or anything else that would result
-    in a "herd effect", causing bursts of traffic and limiting
-    scalability.</para>
-
-    <para>There are many useful functions that can be imagined that aren't
-    included here - revocable read-write priority locks, as just one example.
-    And some of the constructs mentioned here - locks, in particular -
-    illustrate certain points, even though you may find other constructs, such
-    as event handles or queues, a more practical means of performing the same
-    function. In general, the examples in this section are designed to
-    stimulate thought.</para>
-
-  <section id="sc_recipes_errorHandlingNote">
-    <title>Important Note About Error Handling</title>
-
-	<para>When implementing the recipes you must handle recoverable exceptions 
-        (see the <ulink url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ">FAQ</ulink>). In 
-	particular, several of the recipes employ sequential ephemeral 
-	nodes. When creating a sequential ephemeral node there is an error case in 
-	which the create() succeeds on the server but the server crashes before 
-	returning the name of the node to the client. When the client reconnects its 
-	session is still valid and, thus, the node is not removed. The implication is 
-	that it is difficult for the client to know if its node was created or not. The 
-	recipes below include measures to handle this.</para>
-  </section>
-
-  <section id="sc_outOfTheBox">
-    <title>Out of the Box Applications: Name Service, Configuration, Group
-    Membership</title>
-
-    <para>Name service and configuration are two of the primary applications
-    of ZooKeeper. These two functions are provided directly by the ZooKeeper
-    API.</para>
-
-    <para>Another function directly provided by ZooKeeper is <emphasis>group
-    membership</emphasis>. The group is represented by a node. Members of the
-    group create ephemeral nodes under the group node. Nodes of the members
-    that fail abnormally will be removed automatically when ZooKeeper detects
-    the failure.</para>
-  </section>
-
-  <section id="sc_recipes_eventHandles">
-    <title>Barriers</title>
-
-    <para>Distributed systems use <emphasis>barriers</emphasis>
-      to block processing of a set of nodes until a condition is met
-      at which time all the nodes are allowed to proceed. Barriers are
-      implemented in ZooKeeper by designating a barrier node. The
-      barrier is in place if the barrier node exists. Here's the
-      pseudo code:</para>
-
-    <orderedlist>
-      <listitem>
-        <para>Client calls the ZooKeeper API's <emphasis
-        role="bold">exists()</emphasis> function on the barrier node, with
-        <emphasis>watch</emphasis> set to true.</para>
-      </listitem>
-
-      <listitem>
-        <para>If <emphasis role="bold">exists()</emphasis> returns false, the
-        barrier is gone and the client proceeds</para>
-      </listitem>
-
-      <listitem>
-        <para>Else, if <emphasis role="bold">exists()</emphasis> returns true,
-        the clients wait for a watch event from ZooKeeper for the barrier
-        node.</para>
-      </listitem>
-
-      <listitem>
-        <para>When the watch event is triggered, the client reissues the
-        <emphasis role="bold">exists( )</emphasis> call, again waiting until
-        the barrier node is removed.</para>
-      </listitem>
-    </orderedlist>
-
-    <section id="sc_doubleBarriers">
-      <title>Double Barriers</title>
-
-      <para>Double barriers enable clients to synchronize the beginning and
-      the end of a computation. When enough processes have joined the barrier,
-      processes start their computation and leave the barrier once they have
-      finished. This recipe shows how to use a ZooKeeper node as a
-      barrier.</para>
-
-      <para>The pseudo code in this recipe represents the barrier node as
-      <emphasis>b</emphasis>. Every client process <emphasis>p</emphasis>
-      registers with the barrier node on entry and unregisters when it is
-      ready to leave. A node registers with the barrier node via the <emphasis
-      role="bold">Enter</emphasis> procedure below, it waits until
-      <emphasis>x</emphasis> client process register before proceeding with
-      the computation. (The <emphasis>x</emphasis> here is up to you to
-      determine for your system.)</para>
-
-      <informaltable colsep="0" frame="none" rowsep="0">
-        <tgroup cols="2">
-          <tbody>
-            <row>
-              <entry align="center"><emphasis
-                                       role="bold">Enter</emphasis></entry>
-
-              <entry align="center"><emphasis
-                                       role="bold">Leave</emphasis></entry>
-            </row>
-
-            <row>
-              <entry align="left"><orderedlist>
-                  <listitem>
-                    <para>Create a name <emphasis><emphasis>n</emphasis> =
-                        <emphasis>b</emphasis>+“/”+<emphasis>p</emphasis></emphasis></para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Set watch: <emphasis
-                                        role="bold">exists(<emphasis>b</emphasis> + ‘‘/ready’’,
-                        true)</emphasis></para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Create child: <emphasis role="bold">create(
-                        <emphasis>n</emphasis>, EPHEMERAL)</emphasis></para>
-                  </listitem>
-
-                  <listitem>
-                    <para><emphasis role="bold">L = getChildren(b,
-                        false)</emphasis></para>
-                  </listitem>
-
-                  <listitem>
-                    <para>if fewer children in L than<emphasis>
-                        x</emphasis>, wait for watch event</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>else <emphasis role="bold">create(b + ‘‘/ready’’,
-                        REGULAR)</emphasis></para>
-                  </listitem>
-                </orderedlist></entry>
-
-              <entry><orderedlist>
-                  <listitem>
-                    <para><emphasis role="bold">L = getChildren(b,
-                        false)</emphasis></para>
-                  </listitem>
-
-                  <listitem>
-                    <para>if no children, exit</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>if <emphasis>p</emphasis> is only process node in
-                      L, delete(n) and exit</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>if <emphasis>p</emphasis> is the lowest process
-                      node in L, wait on highest process node in L</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>else <emphasis
-                                  role="bold">delete(<emphasis>n</emphasis>) </emphasis>if
-                      still exists and wait on lowest process node in L</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>goto 1</para>
-                  </listitem>
-                </orderedlist></entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </informaltable>
-      <para>On entering, all processes watch on a ready node and
-        create an ephemeral node as a child of the barrier node. Each process
-        but the last enters the barrier and waits for the ready node to appear
-        at line 5. The process that creates the xth node, the last process, will
-        see x nodes in the list of children and create the ready node, waking up
-        the other processes. Note that waiting processes wake up only when it is
-        time to exit, so waiting is efficient.
-      </para>
-
-      <para>On exit, you can't use a flag such as <emphasis>ready</emphasis>
-      because you are watching for process nodes to go away. By using
-      ephemeral nodes, processes that fail after the barrier has been entered
-      do not prevent correct processes from finishing. When processes are
-      ready to leave, they need to delete their process nodes and wait for all
-      other processes to do the same.</para>
-
-      <para>Processes exit when there are no process nodes left as children of
-      <emphasis>b</emphasis>. However, as an efficiency, you can use the
-      lowest process node as the ready flag. All other processes that are
-      ready to exit watch for the lowest existing process node to go away, and
-      the owner of the lowest process watches for any other process node
-      (picking the highest for simplicity) to go away. This means that only a
-      single process wakes up on each node deletion except for the last node,
-      which wakes up everyone when it is removed.</para>
-    </section>
-  </section>
-
-  <section id="sc_recipes_Queues">
-    <title>Queues</title>
-
-    <para>Distributed queues are a common data structure. To implement a
-    distributed queue in ZooKeeper, first designate a znode to hold the queue,
-    the queue node. The distributed clients put something into the queue by
-    calling create() with a pathname ending in "queue-", with the
-    <emphasis>sequence</emphasis> and <emphasis>ephemeral</emphasis> flags in
-    the create() call set to true. Because the <emphasis>sequence</emphasis>
-    flag is set, the new pathnames will have the form
-    _path-to-queue-node_/queue-X, where X is a monotonic increasing number. A
-    client that wants to be removed from the queue calls ZooKeeper's <emphasis
-    role="bold">getChildren( )</emphasis> function, with
-    <emphasis>watch</emphasis> set to true on the queue node, and begins
-    processing nodes with the lowest number. The client does not need to issue
-    another <emphasis role="bold">getChildren( )</emphasis> until it exhausts
-    the list obtained from the first <emphasis role="bold">getChildren(
-    )</emphasis> call. If there are are no children in the queue node, the
-    reader waits for a watch notification to check the queue again.</para>
-
-    <note>
-      <para>There now exists a Queue implementation in ZooKeeper
-      recipes directory. This is distributed with the release --
-      src/recipes/queue directory of the release artifact.
-      </para>
-    </note>
-
-    <section id="sc_recipes_priorityQueues">
-      <title>Priority Queues</title>
-
-      <para>To implement a priority queue, you need only make two simple
-      changes to the generic <ulink url="#sc_recipes_Queues">queue
-      recipe</ulink> . First, to add to a queue, the pathname ends with
-      "queue-YY" where YY is the priority of the element with lower numbers
-      representing higher priority (just like UNIX). Second, when removing
-      from the queue, a client uses an up-to-date children list meaning that
-      the client will invalidate previously obtained children lists if a watch
-      notification triggers for the queue node.</para>
-    </section>
-  </section>
-
-  <section id="sc_recipes_Locks">
-    <title>Locks</title>
-
-    <para>Fully distributed locks that are globally synchronous, meaning at
-    any snapshot in time no two clients think they hold the same lock. These
-    can be implemented using ZooKeeeper. As with priority queues, first define
-    a lock node.</para>
-
-    <note>
-      <para>There now exists a Lock implementation in ZooKeeper
-      recipes directory. This is distributed with the release --
-      src/recipes/lock directory of the release artifact.
-      </para>
-    </note>
-
-    <para>Clients wishing to obtain a lock do the following:</para>
-
-    <orderedlist>
-      <listitem>
-        <para>Call <emphasis role="bold">create( )</emphasis> with a pathname
-        of "_locknode_/guid-lock-" and the <emphasis>sequence</emphasis> and
-        <emphasis>ephemeral</emphasis> flags set. The <emphasis>guid</emphasis> 
-		is needed in case the create() result is missed. See the note below.</para>
-      </listitem>
-
-      <listitem>
-        <para>Call <emphasis role="bold">getChildren( )</emphasis> on the lock
-        node <emphasis>without</emphasis> setting the watch flag (this is
-        important to avoid the herd effect).</para>
-      </listitem>
-
-      <listitem>
-        <para>If the pathname created in step <emphasis
-        role="bold">1</emphasis> has the lowest sequence number suffix, the
-        client has the lock and the client exits the protocol.</para>
-      </listitem>
-
-      <listitem>
-        <para>The client calls <emphasis role="bold">exists( )</emphasis> with
-        the watch flag set on the path in the lock directory with the next
-        lowest sequence number.</para>
-      </listitem>
-
-      <listitem>
-        <para>if <emphasis role="bold">exists( )</emphasis> returns false, go
-        to step <emphasis role="bold">2</emphasis>. Otherwise, wait for a
-        notification for the pathname from the previous step before going to
-        step <emphasis role="bold">2</emphasis>.</para>
-      </listitem>
-    </orderedlist>
-
-    <para>The unlock protocol is very simple: clients wishing to release a
-    lock simply delete the node they created in step 1.</para>
-
-    <para>Here are a few things to notice:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para>The removal of a node will only cause one client to wake up
-        since each node is watched by exactly one client. In this way, you
-        avoid the herd effect.</para>
-      </listitem>
-    </itemizedlist>
-
-    <itemizedlist>
-      <listitem>
-        <para>There is no polling or timeouts.</para>
-      </listitem>
-    </itemizedlist>
-
-    <itemizedlist>
-      <listitem>
-        <para>Because of the way you implement locking, it is easy to see the
-        amount of lock contention, break locks, debug locking problems,
-        etc.</para>
-      </listitem>
-    </itemizedlist>
-
-	<section id="sc_recipes_GuidNote">
-      <title>Recoverable Errors and the GUID</title>
-    <itemizedlist>
-      <listitem>
-        <para>If a recoverable error occurs calling <emphasis role="bold">create()</emphasis> the 
-		client should call <emphasis role="bold">getChildren()</emphasis> and check for a node 
-		containing the <emphasis>guid</emphasis> used in the path name. 
-		This handles the case (noted <ulink url="#sc_recipes_errorHandlingNote">above</ulink>) of 
-		the create() succeeding on the server but the server crashing before returning the name 
-		of the new node.</para>
-      </listitem>
-    </itemizedlist>
-	</section>
-
-    <section>
-      <title>Shared Locks</title>
-
-      <para>You can implement shared locks by with a few changes to the lock
-      protocol:</para>
-
-      <informaltable colsep="0" frame="none" rowsep="0">
-        <tgroup cols="2">
-          <tbody>
-            <row>
-              <entry align="center"><emphasis role="bold">Obtaining a read
-              lock:</emphasis></entry>
-
-              <entry align="center"><emphasis role="bold">Obtaining a write
-              lock:</emphasis></entry>
-            </row>
-
-            <row>
-              <entry align="left"><orderedlist>
-                  <listitem>
-                    <para>Call <emphasis role="bold">create( )</emphasis> to
-                    create a node with pathname
-                    "<filename>guid-/read-</filename>". This is the
-                    lock node use later in the protocol. Make sure to set both
-                    the <emphasis>sequence</emphasis> and
-                    <emphasis>ephemeral</emphasis> flags.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Call <emphasis role="bold">getChildren( )</emphasis>
-                    on the lock node <emphasis>without</emphasis> setting the
-                    <emphasis>watch</emphasis> flag - this is important, as it
-                    avoids the herd effect.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>If there are no children with a pathname starting
-                    with "<filename>write-</filename>" and having a lower
-                    sequence number than the node created in step <emphasis
-                    role="bold">1</emphasis>, the client has the lock and can
-                    exit the protocol. </para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Otherwise, call <emphasis role="bold">exists(
-                    )</emphasis>, with <emphasis>watch</emphasis> flag, set on
-                    the node in lock directory with pathname staring with
-                    "<filename>write-</filename>" having the next lowest
-                    sequence number.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>If <emphasis role="bold">exists( )</emphasis>
-                    returns <emphasis>false</emphasis>, goto step <emphasis
-                    role="bold">2</emphasis>.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Otherwise, wait for a notification for the pathname
-                    from the previous step before going to step <emphasis
-                    role="bold">2</emphasis></para>
-                  </listitem>
-                </orderedlist></entry>
-
-              <entry><orderedlist>
-                  <listitem>
-                    <para>Call <emphasis role="bold">create( )</emphasis> to
-                    create a node with pathname
-                    "<filename>guid-/write-</filename>". This is the
-                    lock node spoken of later in the protocol. Make sure to
-                    set both <emphasis>sequence</emphasis> and
-                    <emphasis>ephemeral</emphasis> flags.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Call <emphasis role="bold">getChildren( )
-                    </emphasis> on the lock node <emphasis>without</emphasis>
-                    setting the <emphasis>watch</emphasis> flag - this is
-                    important, as it avoids the herd effect.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>If there are no children with a lower sequence
-                    number than the node created in step <emphasis
-                    role="bold">1</emphasis>, the client has the lock and the
-                    client exits the protocol.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>Call <emphasis role="bold">exists( ),</emphasis>
-                    with <emphasis>watch</emphasis> flag set, on the node with
-                    the pathname that has the next lowest sequence
-                    number.</para>
-                  </listitem>
-
-                  <listitem>
-                    <para>If <emphasis role="bold">exists( )</emphasis>
-                    returns <emphasis>false</emphasis>, goto step <emphasis
-                    role="bold">2</emphasis>. Otherwise, wait for a
-                    notification for the pathname from the previous step
-                    before going to step <emphasis
-                    role="bold">2</emphasis>.</para>
-                  </listitem>
-                </orderedlist></entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </informaltable>
-
-    <para>Notes:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para>It might appear that this recipe creates a herd effect:
-          when there is a large group of clients waiting for a read
-          lock, and all getting notified more or less simultaneously
-          when the "<filename>write-</filename>" node with the lowest
-          sequence number is deleted. In fact. that's valid behavior:
-          as all those waiting reader clients should be released since
-          they have the lock. The herd effect refers to releasing a
-          "herd" when in fact only a single or a small number of
-          machines can proceed.</para>
-      </listitem>
-    </itemizedlist>
-
-    <itemizedlist>
-      <listitem>
-        <para>See the <ulink url="#sc_recipes_GuidNote">note for Locks</ulink> on how to use the guid in the node.</para>
-      </listitem>
-    </itemizedlist>
-
-	</section>
-
-    <section id="sc_revocableSharedLocks">
-      <title>Revocable Shared Locks</title>
-
-      <para>With minor modifications to the Shared Lock protocol, you make
-      shared locks revocable by modifying the shared lock protocol:</para>
-
-      <para>In step <emphasis role="bold">1</emphasis>, of both obtain reader
-      and writer lock protocols, call <emphasis role="bold">getData(
-      )</emphasis> with <emphasis>watch</emphasis> set, immediately after the
-      call to <emphasis role="bold">create( )</emphasis>. If the client
-      subsequently receives notification for the node it created in step
-      <emphasis role="bold">1</emphasis>, it does another <emphasis
-      role="bold">getData( )</emphasis> on that node, with
-      <emphasis>watch</emphasis> set and looks for the string "unlock", which
-      signals to the client that it must release the lock. This is because,
-      according to this shared lock protocol, you can request the client with
-      the lock give up the lock by calling <emphasis role="bold">setData()
-      </emphasis> on the lock node, writing "unlock" to that node.</para>
-
-      <para>Note that this protocol requires the lock holder to consent to
-      releasing the lock. Such consent is important, especially if the lock
-      holder needs to do some processing before releasing the lock. Of course
-      you can always implement <emphasis>Revocable Shared Locks with Freaking
-      Laser Beams</emphasis> by stipulating in your protocol that the revoker
-      is allowed to delete the lock node if after some length of time the lock
-      isn't deleted by the lock holder.</para>
-    </section>
-  </section>
-
-  <section id="sc_recipes_twoPhasedCommit">
-    <title>Two-phased Commit</title>
-
-    <para>A two-phase commit protocol is an algorithm that lets all clients in
-    a distributed system agree either to commit a transaction or abort.</para>
-
-    <para>In ZooKeeper, you can implement a two-phased commit by having a
-    coordinator create a transaction node, say "/app/Tx", and one child node
-    per participating site, say "/app/Tx/s_i". When coordinator creates the
-    child node, it leaves the content undefined. Once each site involved in
-    the transaction receives the transaction from the coordinator, the site
-    reads each child node and sets a watch. Each site then processes the query
-    and votes "commit" or "abort" by writing to its respective node. Once the
-    write completes, the other sites are notified, and as soon as all sites
-    have all votes, they can decide either "abort" or "commit". Note that a
-    node can decide "abort" earlier if some site votes for "abort".</para>
-
-    <para>An interesting aspect of this implementation is that the only role
-    of the coordinator is to decide upon the group of sites, to create the
-    ZooKeeper nodes, and to propagate the transaction to the corresponding
-    sites. In fact, even propagating the transaction can be done through
-    ZooKeeper by writing it in the transaction node.</para>
-
-    <para>There are two important drawbacks of the approach described above.
-    One is the message complexity, which is O(n²). The second is the
-    impossibility of detecting failures of sites through ephemeral nodes. To
-    detect the failure of a site using ephemeral nodes, it is necessary that
-    the site create the node.</para>
-
-    <para>To solve the first problem, you can have only the coordinator
-    notified of changes to the transaction nodes, and then notify the sites
-    once coordinator reaches a decision. Note that this approach is scalable,
-    but it's is slower too, as it requires all communication to go through the
-    coordinator.</para>
-
-    <para>To address the second problem, you can have the coordinator
-    propagate the transaction to the sites, and have each site creating its
-    own ephemeral node.</para>
-  </section>
-
-  <section id="sc_leaderElection">
-    <title>Leader Election</title>
-
-    <para>A simple way of doing leader election with ZooKeeper is to use the
-    <emphasis role="bold">SEQUENCE|EPHEMERAL</emphasis> flags when creating
-    znodes that represent "proposals" of clients. The idea is to have a znode,
-    say "/election", such that each znode creates a child znode "/election/guid-n_"
-    with both flags SEQUENCE|EPHEMERAL. With the sequence flag, ZooKeeper
-    automatically appends a sequence number that is greater than any one
-    previously appended to a child of "/election". The process that created
-    the znode with the smallest appended sequence number is the leader.
-    </para>
-
-    <para>That's not all, though. It is important to watch for failures of the
-    leader, so that a new client arises as the new leader in the case the
-    current leader fails. A trivial solution is to have all application
-    processes watching upon the current smallest znode, and checking if they
-    are the new leader when the smallest znode goes away (note that the
-    smallest znode will go away if the leader fails because the node is
-    ephemeral). But this causes a herd effect: upon a failure of the current
-    leader, all other processes receive a notification, and execute
-    getChildren on "/election" to obtain the current list of children of
-    "/election". If the number of clients is large, it causes a spike on the
-    number of operations that ZooKeeper servers have to process. To avoid the
-    herd effect, it is sufficient to watch for the next znode down on the
-    sequence of znodes. If a client receives a notification that the znode it
-    is watching is gone, then it becomes the new leader in the case that there
-    is no smaller znode. Note that this avoids the herd effect by not having
-    all clients watching the same znode. </para>
-
-    <para>Here's the pseudo code:</para>
-
-    <para>Let ELECTION be a path of choice of the application. To volunteer to
-    be a leader: </para>
-
-    <orderedlist>
-      <listitem>
-        <para>Create znode z with path "ELECTION/guid-n_" with both SEQUENCE and
-        EPHEMERAL flags;</para>
-      </listitem>
-
-      <listitem>
-        <para>Let C be the children of "ELECTION", and i be the sequence
-        number of z;</para>
-      </listitem>
-
-      <listitem>
-        <para>Watch for changes on "ELECTION/guid-n_j", where j is the largest
-        sequence number such that j &lt; i and n_j is a znode in C;</para>
-      </listitem>
-    </orderedlist>
-
-    <para>Upon receiving a notification of znode deletion: </para>
-
-    <orderedlist>
-      <listitem>
-        <para>Let C be the new set of children of ELECTION; </para>
-      </listitem>
-
-      <listitem>
-        <para>If z is the smallest node in C, then execute leader
-        procedure;</para>
-      </listitem>
-
-      <listitem>
-        <para>Otherwise, watch for changes on "ELECTION/guid-n_j", where j is the
-        largest sequence number such that j &lt; i and n_j is a znode in C;
-        </para>
-      </listitem>
-    </orderedlist>
-
-	<para>Notes:</para>
-
-    <itemizedlist>
-      <listitem>
-	    <para>Note that the znode having no preceding znode on the list of
-	    children does not imply that the creator of this znode is aware that it is
-	    the current leader. Applications may consider creating a separate znode
-	    to acknowledge that the leader has executed the leader procedure. </para>
-      </listitem>
-    </itemizedlist>
-
-    <itemizedlist>
-      <listitem>
-        <para>See the <ulink url="#sc_recipes_GuidNote">note for Locks</ulink> on how to use the guid in the node.</para>
-      </listitem>
-    </itemizedlist>
-
-  </section>
-  </section>
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/site.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/site.xml b/src/docs/src/documentation/content/xdocs/site.xml
deleted file mode 100644
index 614fa6c..0000000
--- a/src/docs/src/documentation/content/xdocs/site.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!--
-Forrest site.xml
-
-This file contains an outline of the site's information content.  It is used to:
-- Generate the website menus (though these can be overridden - see docs)
-- Provide semantic, location-independent aliases for internal 'site:' URIs, eg
-<link href="site:changes"> links to changes.html (or ../changes.html if in
-  subdir).
-- Provide aliases for external URLs in the external-refs section.  Eg, <link
-  href="ext:cocoon"> links to http://xml.apache.org/cocoon/
-
-See http://forrest.apache.org/docs/linking.html for more info.
--->
-
-<site label="ZooKeeper" href="" xmlns="http://apache.org/forrest/linkmap/1.0">
-
-  <docs label="Overview"> 
-    <welcome   label="Welcome"                href="index.html" />
-    <overview  label="Overview"               href="zookeeperOver.html" />
-    <started   label="Getting Started"        href="zookeeperStarted.html" />
-    <relnotes  label="Release Notes"          href="ext:relnotes" />
-  </docs>
-  
-  <docs label="Developer">
-    <api       label="API Docs"               href="ext:api/index" />
-    <program   label="Programmer's Guide"     href="zookeeperProgrammers.html" />
-    <javaEx    label="Java Example"     href="javaExample.html" />
-    <barTutor  label="Barrier and Queue Tutorial" href="zookeeperTutorial.html" />
-    <recipes   label="Recipes"		      href="recipes.html" />
-  </docs>
-  
-  <docs label="Admin &amp; Ops">
-      <admin label="Administrator's Guide"  href="zookeeperAdmin.html" />
-      <quota label="Quota Guide"            href="zookeeperQuotas.html" />
-      <jmx   label="JMX"                    href="zookeeperJMX.html" />
-      <observers label="Observers Guide" href="zookeeperObservers.html" />
-      <reconfig label="Dynamic Reconfiguration" href="zookeeperReconfig.html" />
-  </docs>
-  
-  <docs label="Contributor">
-      <internals label="ZooKeeper Internals"	href="zookeeperInternals.html" />
-  </docs>
-  
-  <docs label="Miscellaneous">
-    <wiki      label="Wiki"                   href="ext:wiki" />
-    <faq       label="FAQ"                    href="ext:faq" />
-    <lists     label="Mailing Lists"          href="ext:lists" />
-    <!--<other     label="Other Info"	      href="zookeeperOtherInfo.html" />-->
-  </docs>
-  
-  
-
-  <external-refs>
-    <site      href="http://zookeeper.apache.org/"/>
-    <lists     href="http://zookeeper.apache.org/mailing_lists.html"/>
-    <releases  href="http://zookeeper.apache.org/releases.html">
-      <download href="#Download" />
-    </releases>
-    <jira      href="http://zookeeper.apache.org/issue_tracking.html"/>
-    <wiki      href="https://cwiki.apache.org/confluence/display/ZOOKEEPER" />
-    <faq       href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ" />
-    <zlib      href="http://www.zlib.net/" />
-    <lzo       href="http://www.oberhumer.com/opensource/lzo/" />
-    <gzip      href="http://www.gzip.org/" />
-    <cygwin    href="http://www.cygwin.com/" />
-    <osx       href="http://www.apple.com/macosx" />
-    <relnotes  href="releasenotes.html" />
-    <api href="api/">
-      <started href="overview-summary.html#overview_description" />
-      <index href="index.html" />
-      <org href="org/">
-        <apache href="apache/">
-          <zookeeper href="zookeeper/">
-          </zookeeper>
-        </apache>
-      </org>
-    </api>
-  </external-refs>
- 
-</site>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/tabs.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/tabs.xml b/src/docs/src/documentation/content/xdocs/tabs.xml
deleted file mode 100644
index af6c447..0000000
--- a/src/docs/src/documentation/content/xdocs/tabs.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.0//EN" 
-          "http://forrest.apache.org/dtd/tab-cocoon-v10.dtd">
-
-<tabs software="ZooKeeper"
-      title="ZooKeeper"
-      copyright="The Apache Software Foundation"
-      xmlns:xlink="http://www.w3.org/1999/xlink">
-
-  <!-- The rules are:
-    @dir will always have /index.html added.
-    @href is not modified unless it is root-relative and obviously specifies a
-    directory (ends in '/'), in which case /index.html will be added
-  -->
-
-  <tab label="Project" href="http://zookeeper.apache.org/" />
-  <tab label="Wiki" href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/" />
-  <tab label="ZooKeeper 3.6 Documentation" dir="" />
-  
-</tabs>


[02/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperQuotas.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperQuotas.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperQuotas.xml
new file mode 100644
index 0000000..7668e6a
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperQuotas.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+		Copyright 2002-2004 The Apache Software Foundation Licensed 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.
+	-->
+                        <!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+                        "http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_Quota">
+	<title>ZooKeeper Quota's Guide</title>
+	<subtitle>A Guide to Deployment and Administration</subtitle>
+	<articleinfo>
+		<legalnotice>
+			<para>
+				Licensed 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
+				<ulink url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0
+				</ulink>
+				.
+			</para>
+			<para>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.</para>
+		</legalnotice>
+		<abstract>
+			<para>This document contains information about deploying,
+				administering and mantaining ZooKeeper. It also discusses best
+				practices and common problems.</para>
+		</abstract>
+	</articleinfo>
+	<section id="zookeeper_quotas">
+	<title>Quotas</title>
+	<para> ZooKeeper has both namespace and bytes quotas. You can use the ZooKeeperMain class to setup quotas.
+	ZooKeeper prints <emphasis>WARN</emphasis> messages if users exceed the quota assigned to them. The messages 
+	are printed in the log of the ZooKeeper. 
+	</para>
+	<para><computeroutput>$ bin/zkCli.sh -server host:port</computeroutput></para>
+	 <para> The above command gives you a command line option of using quotas.</para>
+	 <section>
+	 <title>Setting Quotas</title>
+	<para>You can use 
+	 <emphasis>setquota</emphasis> to set a quota on a ZooKeeper node. It has an option of setting quota with
+	  -n (for namespace)
+	 and -b (for bytes). </para>
+	<para> The ZooKeeper quota are stored in ZooKeeper itself in /zookeeper/quota. To disable other people from
+	changing the quota's set the ACL for /zookeeper/quota such that only admins are able to read and write to it.
+	</para>
+	</section>
+	<section>
+	<title>Listing Quotas</title>
+	<para> You can use
+	<emphasis>listquota</emphasis> to list a quota on a ZooKeeper node.
+	</para>
+	</section>
+	<section>
+	<title> Deleting Quotas</title>
+	<para> You can use
+	<emphasis>delquota</emphasis> to delete quota on a ZooKeeper node.
+	</para>
+	</section>
+	</section>
+	</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperReconfig.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperReconfig.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperReconfig.xml
new file mode 100644
index 0000000..aa6419e
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperReconfig.xml
@@ -0,0 +1,878 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="ar_reconfig">
+  <title>ZooKeeper Dynamic Reconfiguration</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This document contains information about Dynamic Reconfiguration in
+        ZooKeeper.</para>
+    </abstract>
+  </articleinfo>
+  <section id="ch_reconfig_intro">
+    <title>Overview</title>
+    <para>Prior to the 3.5.0 release, the membership and all other configuration
+      parameters of Zookeeper were static - loaded during boot and immutable at
+      runtime. Operators resorted to ''rolling restarts'' - a manually intensive
+      and error-prone method of changing the configuration that has caused data
+      loss and inconsistency in production.</para>
+    <para>Starting with 3.5.0, “rolling restarts” are no longer needed!
+      ZooKeeper comes with full support for automated configuration changes: the
+      set of Zookeeper servers, their roles (participant / observer), all ports,
+      and even the quorum system can be changed dynamically, without service
+      interruption and while maintaining data consistency. Reconfigurations are
+      performed immediately, just like other operations in ZooKeeper. Multiple
+      changes can be done using a single reconfiguration command. The dynamic
+      reconfiguration functionality does not limit operation concurrency, does
+      not require client operations to be stopped during reconfigurations, has a
+      very simple interface for administrators and no added complexity to other
+      client operations.</para>
+    <para>New client-side features allow clients to find out about configuration
+      changes and to update the connection string (list of servers and their
+      client ports) stored in their ZooKeeper handle. A probabilistic algorithm
+      is used to rebalance clients across the new configuration servers while
+      keeping the extent of client migrations proportional to the change in
+      ensemble membership.</para>
+    <para>This document provides the administrator manual for reconfiguration.
+      For a detailed description of the reconfiguration algorithms, performance
+      measurements, and more, please see our paper:</para>
+    <variablelist>
+      <varlistentry>
+        <term>Shraer, A., Reed, B., Malkhi, D., Junqueira, F. Dynamic
+          Reconfiguration of Primary/Backup Clusters. In <emphasis>USENIX Annual
+          Technical Conference (ATC) </emphasis>(2012), 425-437</term>
+        <listitem>
+          <para>Links: <ulink
+            url="https://www.usenix.org/system/files/conference/atc12/atc12-final74.pdf"
+            >paper (pdf)</ulink>, <ulink
+            url="https://www.usenix.org/sites/default/files/conference/protected-files/shraer_atc12_slides.pdf"
+            >slides (pdf)</ulink>, <ulink
+            url="https://www.usenix.org/conference/atc12/technical-sessions/presentation/shraer"
+            >video</ulink>, <ulink
+            url="http://www.slideshare.net/Hadoop_Summit/dynamic-reconfiguration-of-zookeeper"
+            >hadoop summit slides</ulink></para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+    <para><emphasis role="bold">Note:</emphasis> Starting with 3.5.3, the dynamic reconfiguration
+      feature is disabled by default, and has to be explicitly turned on via
+      <ulink url="zookeeperAdmin.html#sc_advancedConfiguration">
+        reconfigEnabled </ulink> configuration option.
+    </para>
+  </section>
+  <section id="ch_reconfig_format">
+    <title>Changes to Configuration Format</title>
+    <section id="sc_reconfig_clientport">
+      <title>Specifying the client port</title>
+      <para>A client port of a server is the port on which the server accepts
+        client connection requests. Starting with 3.5.0 the
+        <emphasis>clientPort</emphasis> and <emphasis>clientPortAddress
+        </emphasis> configuration parameters should no longer be used. Instead,
+        this information is now part of the server keyword specification, which
+        becomes as follows:</para>
+      <para><computeroutput><![CDATA[server.<positive id> = <address1>:<port1>:<port2>[:role];[<client port address>:]<client port>]]></computeroutput></para>
+      <para>The client port specification is to the right of the semicolon. The
+        client port address is optional, and if not specified it defaults to
+        "0.0.0.0". As usual, role is also optional, it can be
+        <emphasis>participant</emphasis> or <emphasis>observer</emphasis>
+        (<emphasis>participant</emphasis> by default).</para>
+      <para> Examples of legal server statements: </para>
+      <itemizedlist>
+        <listitem>
+          <para><computeroutput>server.5 = 125.23.63.23:1234:1235;1236</computeroutput></para>
+        </listitem>
+        <listitem>
+          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:participant;1236</computeroutput></para>
+        </listitem>
+        <listitem>
+          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:observer;1236</computeroutput></para>
+        </listitem>
+        <listitem>
+          <para><computeroutput>server.5 = 125.23.63.23:1234:1235;125.23.63.24:1236</computeroutput></para>
+        </listitem>
+        <listitem>
+          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:participant;125.23.63.23:1236</computeroutput></para>
+        </listitem>
+      </itemizedlist>
+    </section>
+    <section id="sc_reconfig_standaloneEnabled">
+      <title>The <emphasis>standaloneEnabled</emphasis> flag</title>
+      <para>Prior to 3.5.0, one could run ZooKeeper in Standalone mode or in a
+        Distributed mode. These are separate implementation stacks, and
+        switching between them during run time is not possible. By default (for
+        backward compatibility) <emphasis>standaloneEnabled</emphasis> is set to
+        <emphasis>true</emphasis>. The consequence of using this default is that
+        if started with a single server the ensemble will not be allowed to
+        grow, and if started with more than one server it will not be allowed to
+        shrink to contain fewer than two participants.</para>
+      <para>Setting the flag to <emphasis>false</emphasis> instructs the system
+        to run the Distributed software stack even if there is only a single
+        participant in the ensemble. To achieve this the (static) configuration
+        file should contain:</para>
+      <para><computeroutput>standaloneEnabled=false</computeroutput></para>
+      <para>With this setting it is possible to start a ZooKeeper ensemble
+        containing a single participant and to dynamically grow it by adding
+        more servers. Similarly, it is possible to shrink an ensemble so that
+        just a single participant remains, by removing servers.</para>
+      <para>Since running the Distributed mode allows more flexibility, we
+        recommend setting the flag to <emphasis>false</emphasis>. We expect that
+        the legacy Standalone mode will be deprecated in the future.</para>
+    </section>
+    <section id="sc_reconfig_reconfigEnabled">
+      <title>The <emphasis>reconfigEnabled</emphasis> flag</title>
+      <para>Starting with 3.5.0 and prior to 3.5.3, there is no way to disable
+        dynamic reconfiguration feature. We would like to offer the option of
+        disabling reconfiguration feature because with reconfiguration enabled,
+        we have a security concern that a malicious actor can make arbitrary changes
+        to the configuration of a ZooKeeper ensemble, including adding a compromised
+        server to the ensemble. We prefer to leave to the discretion of the user to
+        decide whether to enable it or not and make sure that the appropriate security
+        measure are in place. So in 3.5.3 the <ulink url="zookeeperAdmin.html#sc_advancedConfiguration">
+          reconfigEnabled </ulink> configuration option is introduced
+        such that the reconfiguration feature can be completely disabled and any attempts
+        to reconfigure a cluster through reconfig API with or without authentication
+        will fail by default, unless <emphasis role="bold">reconfigEnabled</emphasis> is set to
+        <emphasis role="bold">true</emphasis>.
+      </para>
+      <para>To set the option to true, the configuration file (zoo.cfg) should contain:</para>
+      <para><computeroutput>reconfigEnabled=true</computeroutput></para>
+    </section>
+    <section id="sc_reconfig_file">
+      <title>Dynamic configuration file</title>
+      <para>Starting with 3.5.0 we're distinguishing between dynamic
+        configuration parameters, which can be changed during runtime, and
+        static configuration parameters, which are read from a configuration
+        file when a server boots and don't change during its execution. For now,
+        the following configuration keywords are considered part of the dynamic
+        configuration: <emphasis>server</emphasis>, <emphasis>group</emphasis>
+        and <emphasis>weight</emphasis>.</para>
+      <para>Dynamic configuration parameters are stored in a separate file on
+        the server (which we call the dynamic configuration file). This file is
+        linked from the static config file using the new
+        <emphasis>dynamicConfigFile</emphasis> keyword.</para>
+      <para><emphasis role="bold">Example</emphasis></para>
+      <example>
+        <title>zoo_replicated1.cfg</title>
+        <programlisting>tickTime=2000
+dataDir=/zookeeper/data/zookeeper1
+initLimit=5
+syncLimit=2
+dynamicConfigFile=/zookeeper/conf/zoo_replicated1.cfg.dynamic</programlisting>
+      </example>
+      <example>
+        <title>zoo_replicated1.cfg.dynamic</title>
+        <programlisting>server.1=125.23.63.23:2780:2783:participant;2791
+server.2=125.23.63.24:2781:2784:participant;2792
+server.3=125.23.63.25:2782:2785:participant;2793</programlisting>
+      </example>
+      <para>When the ensemble configuration changes, the static configuration
+        parameters remain the same. The dynamic parameters are pushed by
+        ZooKeeper and overwrite the dynamic configuration files on all servers.
+        Thus, the dynamic configuration files on the different servers are
+        usually identical (they can only differ momentarily when a
+        reconfiguration is in progress, or if a new configuration hasn't
+        propagated yet to some of the servers). Once created, the dynamic
+        configuration file should not be manually altered. Changed are only made
+        through the new reconfiguration commands outlined below. Note that
+        changing the config of an offline cluster could result in an
+        inconsistency with respect to configuration information stored in the
+        ZooKeeper log (and the special configuration znode, populated from the
+        log) and is therefore highly discouraged.</para>
+      <para><emphasis role="bold">Example 2</emphasis></para>
+      <para>Users may prefer to initially specify a single configuration file.
+        The following is thus also legal:</para>
+      <example>
+        <title>zoo_replicated1.cfg</title>
+        <programlisting>tickTime=2000
+dataDir=/zookeeper/data/zookeeper1
+initLimit=5
+syncLimit=2
+clientPort=<emphasis role="bold">2791</emphasis>  // note that this line is now redundant and therefore not recommended
+server.1=125.23.63.23:2780:2783:participant;<emphasis role="bold">2791</emphasis>
+server.2=125.23.63.24:2781:2784:participant;2792
+server.3=125.23.63.25:2782:2785:participant;2793</programlisting>
+      </example>
+      <para>The configuration files on each server will be automatically split
+        into dynamic and static files, if they are not already in this format.
+        So the configuration file above will be automatically transformed into
+        the two files in Example 1. Note that the clientPort and
+        clientPortAddress lines (if specified) will be automatically removed
+        during this process, if they are redundant (as in the example above).
+        The original static configuration file is backed up (in a .bak
+        file).</para>
+    </section>
+    <section id="sc_reconfig_backward">
+      <title>Backward compatibility</title>
+      <para>We still support the old configuration format. For example, the
+        following configuration file is acceptable (but not recommended):</para>
+      <example>
+        <title>zoo_replicated1.cfg</title>
+        <programlisting>tickTime=2000
+dataDir=/zookeeper/data/zookeeper1
+initLimit=5
+syncLimit=2
+clientPort=2791
+server.1=125.23.63.23:2780:2783:participant
+server.2=125.23.63.24:2781:2784:participant
+server.3=125.23.63.25:2782:2785:participant</programlisting>
+      </example>
+      <para>During boot, a dynamic configuration file is created and contains
+        the dynamic part of the configuration as explained earlier. In this
+        case, however, the line "clientPort=2791" will remain in the static
+        configuration file of server 1 since it is not redundant -- it was not
+        specified as part of the "server.1=..." using the format explained in
+        the section <xref linkend="ch_reconfig_format"/>. If a reconfiguration
+        is invoked that sets the client port of server 1, we remove
+        "clientPort=2791" from the static configuration file (the dynamic file
+        now contain this information as part of the specification of server
+        1).</para>
+    </section>
+  </section>
+  <section id="ch_reconfig_upgrade">
+    <title>Upgrading to 3.5.0</title>
+    <para>Upgrading a running ZooKeeper ensemble to 3.5.0 should be done only
+      after upgrading your ensemble to the 3.4.6 release. Note that this is only
+      necessary for rolling upgrades (if you're fine with shutting down the
+      system completely, you don't have to go through 3.4.6). If you attempt a
+      rolling upgrade without going through 3.4.6 (for example from 3.4.5), you
+      may get the following error:</para>
+    <programlisting>2013-01-30 11:32:10,663 [myid:2] - INFO [localhost/127.0.0.1:2784:QuorumCnxManager$Listener@498] - Received connection request /127.0.0.1:60876
+2013-01-30 11:32:10,663 [myid:2] - WARN [localhost/127.0.0.1:2784:QuorumCnxManager@349] - Invalid server id: -65536</programlisting>
+    <para>During a rolling upgrade, each server is taken down in turn and
+      rebooted with the new 3.5.0 binaries. Before starting the server with
+      3.5.0 binaries, we highly recommend updating the configuration file so
+      that all server statements "server.x=..." contain client ports (see the
+      section <xref linkend="sc_reconfig_clientport"/>). As explained earlier
+      you may leave the configuration in a single file, as well as leave the
+      clientPort/clientPortAddress statements (although if you specify client
+      ports in the new format, these statements are now redundant).</para>
+  </section>
+
+  <section id="ch_reconfig_dyn">
+    <title>Dynamic Reconfiguration of the ZooKeeper Ensemble</title>
+    <para>The ZooKeeper Java and C API were extended with getConfig and reconfig
+      commands that facilitate reconfiguration. Both commands have a synchronous
+      (blocking) variant and an asynchronous one. We demonstrate these commands
+      here using the Java CLI, but note that you can similarly use the C CLI or
+      invoke the commands directly from a program just like any other ZooKeeper
+      command.</para>
+
+    <section id="ch_reconfig_api">
+      <title>API</title>
+      <para>There are two sets of APIs for both Java and C client.
+      </para>
+      <variablelist>
+        <varlistentry>
+          <term><emphasis role="bold">Reconfiguration API</emphasis></term>
+
+          <listitem>
+            <para>Reconfiguration API is used to reconfigure the ZooKeeper cluster.
+              Starting with 3.5.3, reconfiguration Java APIs are moved into ZooKeeperAdmin class
+              from ZooKeeper class, and use of this API requires ACL setup and user
+              authentication (see <xref linkend="sc_reconfig_access_control"/> for more information.).
+            </para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><emphasis role="bold">Get Configuration API</emphasis></term>
+          <listitem>
+            <para>Get configuration APIs are used to retrieve ZooKeeper cluster configuration information
+              stored in /zookeeper/config znode. Use of this API does not require specific setup or authentication,
+            because /zookeeper/config is readable to any users.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </section>
+
+    <section id="sc_reconfig_access_control">
+      <title>Security</title>
+      <para>Prior to <emphasis role="bold">3.5.3</emphasis>, there is no enforced security mechanism
+        over reconfig so any ZooKeeper clients that can connect to ZooKeeper server ensemble
+        will have the ability to change the state of a ZooKeeper cluster via reconfig.
+        It is thus possible for a malicious client to add compromised server to an ensemble,
+        e.g., add a compromised server, or remove legitimate servers.
+        Cases like these could be security vulnerabilities on a case by case basis.
+      </para>
+      <para>To address this security concern, we introduced access control over reconfig
+        starting from <emphasis role="bold">3.5.3</emphasis> such that only a specific set of users
+        can use reconfig commands or APIs, and these users need be configured explicitly. In addition,
+        the setup of ZooKeeper cluster must enable authentication so ZooKeeper clients can be authenticated.
+      </para>
+      <para>
+        We also provides an escape hatch for users who operate and interact with a ZooKeeper ensemble in a secured
+        environment (i.e. behind company firewall). For those users who want to use reconfiguration feature but
+        don't want the overhead of configuring an explicit list of authorized user for reconfig access checks,
+        they can set <ulink url="zookeeperAdmin.html#sc_authOptions">"skipACL"</ulink> to "yes" which will
+        skip ACL check and allow any user to reconfigure cluster.
+      </para>
+      <para>
+        Overall, ZooKeeper provides flexible configuration options for the reconfigure feature
+        that allow a user to choose based on user's security requirement.
+        We leave to the discretion of the user to decide appropriate security measure are in place.
+      </para>
+      <variablelist>
+        <varlistentry>
+          <term><emphasis role="bold">Access Control</emphasis></term>
+
+          <listitem>
+            <para>The dynamic configuration is stored in a special znode
+              ZooDefs.CONFIG_NODE = /zookeeper/config. This node by default is read only
+              for all users, except super user and users that's explicitly configured for write
+              access.
+            </para>
+
+            <para>Clients that need to use reconfig commands or reconfig API should be configured as users
+              that have write access to CONFIG_NODE. By default, only the super user has full control including
+              write access to CONFIG_NODE. Additional users can be granted write access through superuser
+              by setting an ACL that has write permission associated with specified user.
+            </para>
+
+            <para>A few examples of how to setup ACLs and use reconfiguration API with authentication can be found in
+              ReconfigExceptionTest.java and TestReconfigServer.cc.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><emphasis role="bold">Authentication</emphasis></term>
+
+          <listitem>
+            <para>Authentication of users is orthogonal to the access control and is delegated to
+              existing authentication mechanism supported by ZooKeeper's pluggable authentication schemes.
+              See <ulink
+                      url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zookeeper+and+SASL"
+              >ZooKeeper and SASL</ulink> for more details on this topic.
+            </para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><emphasis role="bold">Disable ACL check</emphasis></term>
+          <listitem>
+            <para>
+              ZooKeeper supports <ulink
+                    url="zookeeperAdmin.html#sc_authOptions">"skipACL"</ulink> option such that ACL
+              check will be completely skipped, if skipACL is set to "yes". In such cases any unauthenticated
+              users can use reconfig API.
+            </para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </section>
+
+    <section id="sc_reconfig_retrieving">
+      <title>Retrieving the current dynamic configuration</title>
+      <para>The dynamic configuration is stored in a special znode
+        ZooDefs.CONFIG_NODE = /zookeeper/config. The new
+        <command>config</command> CLI command reads this znode (currently it is
+        simply a wrapper to <command>get /zookeeper/config</command>). As with
+        normal reads, to retrieve the latest committed value you should do a
+        <command>sync</command> first.</para>
+      <programlisting>[zk: 127.0.0.1:2791(CONNECTED) 3] config
+server.1=localhost:2780:2783:participant;localhost:2791
+server.2=localhost:2781:2784:participant;localhost:2792
+server.3=localhost:2782:2785:participant;localhost:2793
+<emphasis role="bold">version=400000003</emphasis></programlisting>
+      <para>Notice the last line of the output. This is the configuration
+        version. The version equals to the zxid of the reconfiguration command
+        which created this configuration. The version of the first established
+        configuration equals to the zxid of the NEWLEADER message sent by the
+        first successfully established leader. When a configuration is written
+        to a dynamic configuration file, the version automatically becomes part
+        of the filename and the static configuration file is updated with the
+        path to the new dynamic configuration file. Configuration files
+        corresponding to earlier versions are retained for backup
+        purposes.</para>
+      <para>During boot time the version (if it exists) is extracted from the
+        filename. The version should never be altered manually by users or the
+        system administrator. It is used by the system to know which
+        configuration is most up-to-date. Manipulating it manually can result in
+        data loss and inconsistency.</para>
+      <para>Just like a <command>get</command> command, the
+        <command>config</command> CLI command accepts the <option>-w</option>
+        flag for setting a watch on the znode, and <option>-s</option> flag for
+        displaying the Stats of the znode. It additionally accepts a new flag
+        <option>-c</option> which outputs only the version and the client
+        connection string corresponding to the current configuration. For
+        example, for the configuration above we would get:</para>
+      <programlisting>[zk: 127.0.0.1:2791(CONNECTED) 17] config -c
+400000003 localhost:2791,localhost:2793,localhost:2792</programlisting>
+      <para>Note that when using the API directly, this command is called
+        <command>getConfig</command>.</para>
+      <para>As any read command it returns the configuration known to the
+        follower to which your client is connected, which may be slightly
+        out-of-date. One can use the <command>sync</command> command for
+        stronger guarantees. For example using the Java API:</para>
+      <programlisting>zk.sync(ZooDefs.CONFIG_NODE, void_callback, context);
+zk.getConfig(watcher, callback, context);</programlisting>
+      <para>Note: in 3.5.0 it doesn't really matter which path is passed to the
+        <command>sync() </command> command as all the server's state is brought
+        up to date with the leader (so one could use a different path instead of
+        ZooDefs.CONFIG_NODE). However, this may change in the future.</para>
+    </section>
+    <section id="sc_reconfig_modifying">
+      <title>Modifying the current dynamic configuration</title>
+      <para>Modifying the configuration is done through the
+        <command>reconfig</command> command. There are two modes of
+        reconfiguration: incremental and non-incremental (bulk). The
+        non-incremental simply specifies the new dynamic configuration of the
+        system. The incremental specifies changes to the current configuration.
+        The <command>reconfig</command> command returns the new
+        configuration.</para>
+      <para>A few examples are in: <filename>ReconfigTest.java</filename>,
+        <filename>ReconfigRecoveryTest.java</filename> and
+        <filename>TestReconfigServer.cc</filename>.</para>
+      <section id="sc_reconfig_general">
+        <title>General</title>
+        <para><emphasis role="bold">Removing servers:</emphasis> Any server can
+          be removed, including the leader (although removing the leader will
+          result in a short unavailability, see Figures 6 and 8 in the <ulink
+          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
+          >paper</ulink>). The server will not be shut-down automatically.
+          Instead, it becomes a "non-voting follower". This is somewhat similar
+          to an observer in that its votes don't count towards the Quorum of
+          votes necessary to commit operations. However, unlike a non-voting
+          follower, an observer doesn't actually see any operation proposals and
+          does not ACK them. Thus a non-voting follower has a more significant
+          negative effect on system throughput compared to an observer.
+          Non-voting follower mode should only be used as a temporary mode,
+          before shutting the server down, or adding it as a follower or as an
+          observer to the ensemble. We do not shut the server down automatically
+          for two main reasons. The first reason is that we do not want all the
+          clients connected to this server to be immediately disconnected,
+          causing a flood of connection requests to other servers. Instead, it
+          is better if each client decides when to migrate independently. The
+          second reason is that removing a server may sometimes (rarely) be
+          necessary in order to change it from "observer" to "participant" (this
+          is explained in the section <xref linkend="sc_reconfig_additional"
+          />).</para>
+        <para>Note that the new configuration should have some minimal number of
+          participants in order to be considered legal. If the proposed change
+          would leave the cluster with less than 2 participants and standalone
+          mode is enabled (standaloneEnabled=true, see the section <xref
+          linkend="sc_reconfig_standaloneEnabled"/>), the reconfig will not be
+          processed (BadArgumentsException). If standalone mode is disabled
+          (standaloneEnabled=false) then its legal to remain with 1 or more
+          participants.</para>
+        <para><emphasis role="bold">Adding servers:</emphasis> Before a
+          reconfiguration is invoked, the administrator must make sure that a
+          quorum (majority) of participants from the new configuration are
+          already connected and synced with the current leader. To achieve this
+          we need to connect a new joining server to the leader before it is
+          officially part of the ensemble. This is done by starting the joining
+          server using an initial list of servers which is technically not a
+          legal configuration of the system but (a) contains the joiner, and (b)
+          gives sufficient information to the joiner in order for it to find and
+          connect to the current leader. We list a few different options of
+          doing this safely.</para>
+        <orderedlist>
+          <listitem>
+            <para>Initial configuration of joiners is comprised of servers in
+              the last committed configuration and one or more joiners, where
+              <emphasis role="bold">joiners are listed as observers.</emphasis>
+              For example, if servers D and E are added at the same time to (A,
+              B, C) and server C is being removed, the initial configuration of
+              D could be (A, B, C, D) or (A, B, C, D, E), where D and E are
+              listed as observers. Similarly, the configuration of E could be
+              (A, B, C, E) or (A, B, C, D, E), where D and E are listed as
+              observers. <emphasis role="bold">Note that listing the joiners as
+              observers will not actually make them observers - it will only
+              prevent them from accidentally forming a quorum with other
+              joiners.</emphasis> Instead, they will contact the servers in the
+              current configuration and adopt the last committed configuration
+              (A, B, C), where the joiners are absent. Configuration files of
+              joiners are backed up and replaced automatically as this happens.
+              After connecting to the current leader, joiners become non-voting
+              followers until the system is reconfigured and they are added to
+              the ensemble (as participant or observer, as appropriate).</para>
+          </listitem>
+          <listitem>
+            <para>Initial configuration of each joiner is comprised of servers
+              in the last committed configuration + <emphasis role="bold">the
+              joiner itself, listed as a participant.</emphasis> For example, to
+              add a new server D to a configuration consisting of servers (A, B,
+              C), the administrator can start D using an initial configuration
+              file consisting of servers (A, B, C, D). If both D and E are added
+              at the same time to (A, B, C), the initial configuration of D
+              could be (A, B, C, D) and the configuration of E could be (A, B,
+              C, E). Similarly, if D is added and C is removed at the same time,
+              the initial configuration of D could be (A, B, C, D). Never list
+              more than one joiner as participant in the initial configuration
+              (see warning below).</para>
+          </listitem>
+          <listitem>
+            <para>Whether listing the joiner as an observer or as participant,
+              it is also fine not to list all the current configuration servers,
+              as long as the current leader is in the list. For example, when
+              adding D we could start D with a configuration file consisting of
+              just (A, D) if A is the current leader. however this is more
+              fragile since if A fails before D officially joins the ensemble, D
+              doesn’t know anyone else and therefore the administrator will have
+              to intervene and restart D with another server list.</para>
+          </listitem>
+        </orderedlist>
+        <note>
+          <title>Warning</title>
+          <para>Never specify more than one joining server in the same initial
+            configuration as participants. Currently, the joining servers don’t
+            know that they are joining an existing ensemble; if multiple joiners
+            are listed as participants they may form an independent quorum
+            creating a split-brain situation such as processing operations
+            independently from your main ensemble. It is OK to list multiple
+            joiners as observers in an initial config.</para>
+        </note>
+        <para>If the configuration of existing servers changes or they become unavailable
+          before the joiner succeeds to connect and learn obout configuration changes, the
+          joiner may need to be restarted with an updated configuration file in order to be
+          able to connect.</para>
+        <para>Finally, note that once connected to the leader, a joiner adopts
+          the last committed configuration, in which it is absent (the initial
+          config of the joiner is backed up before being rewritten). If the
+          joiner restarts in this state, it will not be able to boot since it is
+          absent from its configuration file. In order to start it you’ll once
+          again have to specify an initial configuration.</para>
+        <para><emphasis role="bold">Modifying server parameters:</emphasis> One
+          can modify any of the ports of a server, or its role
+          (participant/observer) by adding it to the ensemble with different
+          parameters. This works in both the incremental and the bulk
+          reconfiguration modes. It is not necessary to remove the server and
+          then add it back; just specify the new parameters as if the server is
+          not yet in the system. The server will detect the configuration change
+          and perform the necessary adjustments. See an example in the section
+          <xref linkend="sc_reconfig_incremental"/> and an exception to this
+          rule in the section <xref linkend="sc_reconfig_additional"/>.</para>
+        <para>It is also possible to change the Quorum System used by the
+          ensemble (for example, change the Majority Quorum System to a
+          Hierarchical Quorum System on the fly). This, however, is only allowed
+          using the bulk (non-incremental) reconfiguration mode. In general,
+          incremental reconfiguration only works with the Majority Quorum
+          System. Bulk reconfiguration works with both Hierarchical and Majority
+          Quorum Systems.</para>
+        <para><emphasis role="bold">Performance Impact:</emphasis> There is
+          practically no performance impact when removing a follower, since it
+          is not being automatically shut down (the effect of removal is that
+          the server's votes are no longer being counted). When adding a server,
+          there is no leader change and no noticeable performance disruption.
+          For details and graphs please see Figures 6, 7 and 8 in the <ulink
+          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
+          >paper</ulink>.</para>
+        <para>The most significant disruption will happen when a leader change
+          is caused, in one of the following cases:</para>
+        <orderedlist>
+          <listitem>
+            <para>Leader is removed from the ensemble.</para>
+          </listitem>
+          <listitem>
+            <para>Leader's role is changed from participant to observer.</para>
+          </listitem>
+          <listitem>
+            <para>The port used by the leader to send transactions to others
+              (quorum port) is modified.</para>
+          </listitem>
+        </orderedlist>
+        <para>In these cases we perform a leader hand-off where the old leader
+          nominates a new leader. The resulting unavailability is usually
+          shorter than when a leader crashes since detecting leader failure is
+          unnecessary and electing a new leader can usually be avoided during a
+          hand-off (see Figures 6 and 8 in the <ulink
+          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
+          >paper</ulink>).</para>
+        <para>When the client port of a server is modified, it does not drop
+          existing client connections. New connections to the server will have
+          to use the new client port.</para>
+        <para><emphasis role="bold">Progress guarantees:</emphasis> Up to the
+          invocation of the reconfig operation, a quorum of the old
+          configuration is required to be available and connected for ZooKeeper
+          to be able to make progress. Once reconfig is invoked, a quorum of
+          both the old and of the new configurations must be available. The
+          final transition happens once (a) the new configuration is activated,
+          and (b) all operations scheduled before the new configuration is
+          activated by the leader are committed. Once (a) and (b) happen, only a
+          quorum of the new configuration is required. Note, however, that
+          neither (a) nor (b) are visible to a client. Specifically, when a
+          reconfiguration operation commits, it only means that an activation
+          message was sent out by the leader. It does not necessarily mean that
+          a quorum of the new configuration got this message (which is required
+          in order to activate it) or that (b) has happened. If one wants to
+          make sure that both (a) and (b) has already occurred (for example, in
+          order to know that it is safe to shut down old servers that were
+          removed), one can simply invoke an update
+          (<command>set-data</command>, or some other quorum operation, but not
+          a <command>sync</command>) and wait for it to commit. An alternative
+          way to achieve this was to introduce another round to the
+          reconfiguration protocol (which, for simplicity and compatibility with
+          Zab, we decided to avoid).</para>
+      </section>
+      <section id="sc_reconfig_incremental">
+        <title>Incremental mode</title>
+        <para>The incremental mode allows adding and removing servers to the
+          current configuration. Multiple changes are allowed. For
+          example:</para>
+        <para><userinput>&gt; reconfig -remove 3 -add
+          server.5=125.23.63.23:1234:1235;1236</userinput></para>
+        <para>Both the add and the remove options get a list of comma separated
+          arguments (no spaces):</para>
+        <para><userinput>&gt; reconfig -remove 3,4 -add
+          server.5=localhost:2111:2112;2113,6=localhost:2114:2115:observer;2116</userinput></para>
+        <para>The format of the server statement is exactly the same as
+          described in the section <xref linkend="sc_reconfig_clientport"/> and
+          includes the client port. Notice that here instead of "server.5=" you
+          can just say "5=". In the example above, if server 5 is already in the
+          system, but has different ports or is not an observer, it is updated
+          and once the configuration commits becomes an observer and starts
+          using these new ports. This is an easy way to turn participants into
+          observers and vise versa or change any of their ports, without
+          rebooting the server.</para>
+        <para>ZooKeeper supports two types of Quorum Systems – the simple
+          Majority system (where the leader commits operations after receiving
+          ACKs from a majority of voters) and a more complex Hierarchical
+          system, where votes of different servers have different weights and
+          servers are divided into voting groups. Currently, incremental
+          reconfiguration is allowed only if the last proposed configuration
+          known to the leader uses a Majority Quorum System
+          (BadArgumentsException is thrown otherwise).</para>
+        <para>Incremental mode - examples using the Java API:</para>
+        <programlisting><![CDATA[List<String> leavingServers = new ArrayList<String>();
+leavingServers.add("1");
+leavingServers.add("2");
+byte[] config = zk.reconfig(null, leavingServers, null, -1, new Stat());]]></programlisting>
+
+        <programlisting><![CDATA[List<String> leavingServers = new ArrayList<String>();
+List<String> joiningServers = new ArrayList<String>();
+leavingServers.add("1");
+joiningServers.add("server.4=localhost:1234:1235;1236");
+byte[] config = zk.reconfig(joiningServers, leavingServers, null, -1, new Stat());
+
+String configStr = new String(config);
+System.out.println(configStr);]]></programlisting>
+        <para>There is also an asynchronous API, and an API accepting comma
+          separated Strings instead of List&lt;String&gt;. See
+          src/java/main/org/apache/zookeeper/ZooKeeper.java.</para>
+      </section>
+      <section id="sc_reconfig_nonincremental">
+        <title>Non-incremental mode</title>
+        <para>The second mode of reconfiguration is non-incremental, whereby a
+          client gives a complete specification of the new dynamic system
+          configuration. The new configuration can either be given in place or
+          read from a file:</para>
+        <para><userinput>&gt; reconfig -file newconfig.cfg
+          </userinput>//newconfig.cfg is a dynamic config file, see <xref
+          linkend="sc_reconfig_file"/></para>
+        <para><userinput>&gt; reconfig -members
+          server.1=125.23.63.23:2780:2783:participant;2791,server.2=125.23.63.24:2781:2784:participant;2792,server.3=125.23.63.25:2782:2785:participant;2793</userinput></para>
+        <para>The new configuration may use a different Quorum System. For
+          example, you may specify a Hierarchical Quorum System even if the
+          current ensemble uses a Majority Quorum System.</para>
+        <para>Bulk mode - example using the Java API:</para>
+        <programlisting><![CDATA[List<String> newMembers = new ArrayList<String>();
+newMembers.add("server.1=1111:1234:1235;1236");
+newMembers.add("server.2=1112:1237:1238;1239");
+newMembers.add("server.3=1114:1240:1241:observer;1242");
+
+byte[] config = zk.reconfig(null, null, newMembers, -1, new Stat());
+
+String configStr = new String(config);
+System.out.println(configStr);]]></programlisting>
+        <para>There is also an asynchronous API, and an API accepting comma
+          separated String containing the new members instead of
+          List&lt;String&gt;. See
+          src/java/main/org/apache/zookeeper/ZooKeeper.java.</para>
+      </section>
+      <section id="sc_reconfig_conditional">
+        <title>Conditional reconfig</title>
+        <para>Sometimes (especially in non-incremental mode) a new proposed
+          configuration depends on what the client "believes" to be the current
+          configuration, and should be applied only to that configuration.
+          Specifically, the <command>reconfig</command> succeeds only if the
+          last configuration at the leader has the specified version.</para>
+        <para><userinput><![CDATA[> reconfig -file <filename> -v <version>]]></userinput></para>
+        <para>In the previously listed Java examples, instead of -1 one could
+          specify a configuration version to condition the
+          reconfiguration.</para>
+      </section>
+      <section id="sc_reconfig_errors">
+        <title>Error conditions</title>
+        <para>In addition to normal ZooKeeper error conditions, a
+          reconfiguration may fail for the following reasons:</para>
+        <orderedlist>
+          <listitem>
+            <para>another reconfig is currently in progress
+              (ReconfigInProgress)</para>
+          </listitem>
+          <listitem>
+            <para>the proposed change would leave the cluster with less than 2
+              participants, in case standalone mode is enabled, or, if
+              standalone mode is disabled then its legal to remain with 1 or
+              more participants (BadArgumentsException)</para>
+          </listitem>
+          <listitem>
+            <para>no quorum of the new configuration was connected and
+              up-to-date with the leader when the reconfiguration processing
+              began (NewConfigNoQuorum)</para>
+          </listitem>
+          <listitem>
+            <para><userinput>-v x</userinput> was specified, but the version
+              <userinput>y</userinput> of the latest configuration is not
+              <userinput>x</userinput> (BadVersionException)</para>
+          </listitem>
+          <listitem>
+            <para>an incremental reconfiguration was requested but the last
+              configuration at the leader uses a Quorum System which is
+              different from the Majority system (BadArgumentsException)</para>
+          </listitem>
+          <listitem>
+            <para>syntax error (BadArgumentsException)</para>
+          </listitem>
+          <listitem>
+            <para>I/O exception when reading the configuration from a file
+              (BadArgumentsException)</para>
+          </listitem>
+        </orderedlist>
+        <para>Most of these are illustrated by test-cases in
+          <filename>ReconfigFailureCases.java</filename>.</para>
+      </section>
+      <section id="sc_reconfig_additional">
+        <title>Additional comments</title>
+        <para><emphasis role="bold">Liveness:</emphasis> To better understand
+          the difference between incremental and non-incremental
+          reconfiguration, suppose that client C1 adds server D to the system
+          while a different client C2 adds server E. With the non-incremental
+          mode, each client would first invoke <command>config</command> to find
+          out the current configuration, and then locally create a new list of
+          servers by adding its own suggested server. The new configuration can
+          then be submitted using the non-incremental
+          <command>reconfig</command> command. After both reconfigurations
+          complete, only one of E or D will be added (not both), depending on
+          which client's request arrives second to the leader, overwriting the
+          previous configuration. The other client can repeat the process until
+          its change takes effect. This method guarantees system-wide progress
+          (i.e., for one of the clients), but does not ensure that every client
+          succeeds. To have more control C2 may request to only execute the
+          reconfiguration in case the version of the current configuration
+          hasn't changed, as explained in the section <xref
+          linkend="sc_reconfig_conditional"/>. In this way it may avoid blindly
+          overwriting the configuration of C1 if C1's configuration reached the
+          leader first.</para>
+        <para>With incremental reconfiguration, both changes will take effect as
+          they are simply applied by the leader one after the other to the
+          current configuration, whatever that is (assuming that the second
+          reconfig request reaches the leader after it sends a commit message
+          for the first reconfig request -- currently the leader will refuse to
+          propose a reconfiguration if another one is already pending). Since
+          both clients are guaranteed to make progress, this method guarantees
+          stronger liveness. In practice, multiple concurrent reconfigurations
+          are probably rare. Non-incremental reconfiguration is currently the
+          only way to dynamically change the Quorum System. Incremental
+          configuration is currently only allowed with the Majority Quorum
+          System.</para>
+        <para><emphasis role="bold">Changing an observer into a
+          follower:</emphasis> Clearly, changing a server that participates in
+          voting into an observer may fail if error (2) occurs, i.e., if fewer
+          than the minimal allowed number of participants would remain. However,
+          converting an observer into a participant may sometimes fail for a
+          more subtle reason: Suppose, for example, that the current
+          configuration is (A, B, C, D), where A is the leader, B and C are
+          followers and D is an observer. In addition, suppose that B has
+          crashed. If a reconfiguration is submitted where D is said to become a
+          follower, it will fail with error (3) since in this configuration, a
+          majority of voters in the new configuration (any 3 voters), must be
+          connected and up-to-date with the leader. An observer cannot
+          acknowledge the history prefix sent during reconfiguration, and
+          therefore it does not count towards these 3 required servers and the
+          reconfiguration will be aborted. In case this happens, a client can
+          achieve the same task by two reconfig commands: first invoke a
+          reconfig to remove D from the configuration and then invoke a second
+          command to add it back as a participant (follower). During the
+          intermediate state D is a non-voting follower and can ACK the state
+          transfer performed during the second reconfig comand.</para>
+      </section>
+    </section>
+  </section>
+  <section id="ch_reconfig_rebalancing">
+    <title>Rebalancing Client Connections</title>
+    <para>When a ZooKeeper cluster is started, if each client is given the same
+      connection string (list of servers), the client will randomly choose a
+      server in the list to connect to, which makes the expected number of
+      client connections per server the same for each of the servers. We
+      implemented a method that preserves this property when the set of servers
+      changes through reconfiguration. See Sections 4 and 5.1 in the <ulink
+      url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
+      >paper</ulink>.</para>
+    <para>In order for the method to work, all clients must subscribe to
+      configuration changes (by setting a watch on /zookeeper/config either
+      directly or through the <command>getConfig</command> API command). When
+      the watch is triggered, the client should read the new configuration by
+      invoking <command>sync</command> and <command>getConfig</command> and if
+      the configuration is indeed new invoke the
+      <command>updateServerList</command> API command. To avoid mass client
+      migration at the same time, it is better to have each client sleep a
+      random short period of time before invoking
+      <command>updateServerList</command>.</para>
+    <para>A few examples can be found in:
+      <filename>StaticHostProviderTest.java</filename> and
+      <filename>TestReconfig.cc</filename></para>
+    <para>Example (this is not a recipe, but a simplified example just to
+      explain the general idea):</para>
+    <programlisting><![CDATA[
+public void process(WatchedEvent event) {
+    synchronized (this) {
+        if (event.getType() == EventType.None) {
+            connected = (event.getState() == KeeperState.SyncConnected);
+            notifyAll();
+        } else if (event.getPath()!=null &&  event.getPath().equals(ZooDefs.CONFIG_NODE)) {
+            // in prod code never block the event thread!
+            zk.sync(ZooDefs.CONFIG_NODE, this, null);
+            zk.getConfig(this, this, null);
+        }
+    }
+}
+public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) {
+    if (path!=null &&  path.equals(ZooDefs.CONFIG_NODE)) {
+        String config[] = ConfigUtils.getClientConfigStr(new String(data)).split(" ");   // similar to config -c
+        long version = Long.parseLong(config[0], 16);
+        if (this.configVersion == null){
+             this.configVersion = version;
+        } else if (version > this.configVersion) {
+            hostList = config[1];
+            try {
+                // the following command is not blocking but may cause the client to close the socket and
+                // migrate to a different server. In practice its better to wait a short period of time, chosen
+                // randomly, so that different clients migrate at different times
+                zk.updateServerList(hostList);
+            } catch (IOException e) {
+                System.err.println("Error updating server list");
+                e.printStackTrace();
+            }
+            this.configVersion = version;
+} } }]]></programlisting>
+  </section>
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperStarted.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperStarted.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperStarted.xml
new file mode 100644
index 0000000..e5cd777
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperStarted.xml
@@ -0,0 +1,419 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_GettStartedGuide">
+  <title>ZooKeeper Getting Started Guide</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This guide contains detailed information about creating
+      distributed applications that use ZooKeeper. It discusses the basic
+      operations ZooKeeper supports, and how these can be used to build
+      higher-level abstractions. It contains solutions to common tasks, a
+      troubleshooting guide, and links to other information.</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_GettingStarted">
+    <title>Getting Started: Coordinating Distributed Applications with
+      ZooKeeper</title>
+
+    <para>This document contains information to get you started quickly with
+    ZooKeeper. It is aimed primarily at developers hoping to try it out, and
+    contains simple installation instructions for a single ZooKeeper server, a
+    few commands to verify that it is running, and a simple programming
+    example. Finally, as a convenience, there are a few sections regarding
+    more complicated installations, for example running replicated
+    deployments, and optimizing the transaction log. However for the complete
+    instructions for commercial deployments, please refer to the <ulink
+    url="zookeeperAdmin.html">ZooKeeper
+    Administrator's Guide</ulink>.</para>
+
+    <section id="sc_Prerequisites">
+      <title>Pre-requisites</title>
+
+      <para>See <ulink url="zookeeperAdmin.html#sc_systemReq">
+          System Requirements</ulink> in the Admin guide.</para>
+    </section>
+
+    <section id="sc_Download">
+      <title>Download</title>
+
+      <para>To get a ZooKeeper distribution, download a recent
+        <ulink url="http://zookeeper.apache.org/releases.html">
+          stable</ulink> release from one of the Apache Download
+        Mirrors.</para>
+    </section>
+	
+    <section id="sc_InstallingSingleMode">
+      <title>Standalone Operation</title>
+
+      <para>Setting up a ZooKeeper server in standalone mode is
+      straightforward. The server is contained in a single JAR file,
+      so installation consists of creating a configuration.</para>
+
+      <para>Once you've downloaded a stable ZooKeeper release unpack
+      it and cd to the root</para>
+
+      <para>To start ZooKeeper you need a configuration file. Here is a sample,
+      create it in <emphasis role="bold">conf/zoo.cfg</emphasis>:</para>
+
+<programlisting>
+tickTime=2000
+dataDir=/var/lib/zookeeper
+clientPort=2181
+</programlisting>
+
+      <para>This file can be called anything, but for the sake of this
+      discussion call
+      it <emphasis role="bold">conf/zoo.cfg</emphasis>. Change the
+      value of <emphasis role="bold">dataDir</emphasis> to specify an
+      existing (empty to start with) directory.  Here are the meanings
+      for each of the fields:</para>
+
+      <variablelist>
+        <varlistentry>
+          <term><emphasis role="bold">tickTime</emphasis></term>
+
+          <listitem>
+            <para>the basic time unit in milliseconds used by ZooKeeper. It is
+            used to do heartbeats and the minimum session timeout will be
+            twice the tickTime.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+
+      <variablelist>
+        <varlistentry>
+          <term><emphasis role="bold">dataDir</emphasis></term>
+
+          <listitem>
+            <para>the location to store the in-memory database snapshots and,
+            unless specified otherwise, the transaction log of updates to the
+            database.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term><emphasis role="bold">clientPort</emphasis></term>
+
+          <listitem>
+            <para>the port to listen for client connections</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+
+      <para>Now that you created the configuration file, you can start
+      ZooKeeper:</para>
+
+      <programlisting>bin/zkServer.sh start</programlisting>
+
+      <para>ZooKeeper logs messages using log4j -- more detail
+      available in the
+      <ulink url="zookeeperProgrammers.html#Logging">Logging</ulink>
+      section of the Programmer's Guide. You will see log messages
+      coming to the console (default) and/or a log file depending on
+      the log4j configuration.</para>
+
+      <para>The steps outlined here run ZooKeeper in standalone mode. There is
+      no replication, so if ZooKeeper process fails, the service will go down.
+      This is fine for most development situations, but to run ZooKeeper in
+      replicated mode, please see <ulink
+      url="#sc_RunningReplicatedZooKeeper">Running Replicated
+      ZooKeeper</ulink>.</para>
+    </section>
+	
+    <section id="sc_FileManagement">
+      <title>Managing ZooKeeper Storage</title>
+      <para>For long running production systems ZooKeeper storage must
+      be managed externally (dataDir and logs). See the section on
+      <ulink
+      url="zookeeperAdmin.html#sc_maintenance">maintenance</ulink> for
+      more details.</para>
+    </section>
+
+    <section id="sc_ConnectingToZooKeeper">
+      <title>Connecting to ZooKeeper</title>
+
+      <programlisting>$ bin/zkCli.sh -server 127.0.0.1:2181</programlisting>
+
+      <para>This lets you perform simple, file-like operations.</para>
+
+      <para>Once you have connected, you should see something like:
+        </para>
+      <programlisting>
+<![CDATA[
+Connecting to localhost:2181
+log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
+log4j:WARN Please initialize the log4j system properly.
+Welcome to ZooKeeper!
+JLine support is enabled
+[zkshell: 0]
+]]>        </programlisting>
+      <para>
+        From the shell, type <command>help</command> to get a listing of commands that can be executed from the client, as in:
+      </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 0] help
+ZooKeeper host:port cmd args
+        get path [watch]
+        ls path [watch]
+        set path data [version]
+        delquota [-n|-b] path
+        quit
+        printwatches on|off
+        create path data acl
+        stat path [watch]
+        listquota path
+        history
+        setAcl path acl
+        getAcl path
+        sync path
+        redo cmdno
+        addauth scheme auth
+        delete path [version]
+        deleteall path
+        setquota -n|-b val path
+
+]]>        </programlisting>
+      <para>From here, you can try a few simple commands to get a feel for this simple command line interface.  First, start by issuing the list command, as
+      in <command>ls</command>, yielding:
+      </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 8] ls /
+[zookeeper]
+]]>        </programlisting>
+      <para>Next, create a new znode by running <command>create /zk_test my_data</command>. This creates a new znode and associates the string "my_data" with the node.
+      You should see:</para>
+      <programlisting>
+<![CDATA[
+[zkshell: 9] create /zk_test my_data
+Created /zk_test
+]]>      </programlisting>
+      <para>  Issue another <command>ls /</command> command to see what the directory looks like:
+        </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 11] ls /
+[zookeeper, zk_test]
+
+]]>        </programlisting><para>
+      Notice that the zk_test directory has now been created.
+      </para>
+      <para>Next, verify that the data was associated with the znode by running the <command>get</command> command, as in:
+      </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 12] get /zk_test
+my_data
+cZxid = 5
+ctime = Fri Jun 05 13:57:06 PDT 2009
+mZxid = 5
+mtime = Fri Jun 05 13:57:06 PDT 2009
+pZxid = 5
+cversion = 0
+dataVersion = 0
+aclVersion = 0
+ephemeralOwner = 0
+dataLength = 7
+numChildren = 0
+]]>        </programlisting>
+      <para>We can change the data associated with zk_test by issuing the <command>set</command> command, as in:
+        </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 14] set /zk_test junk
+cZxid = 5
+ctime = Fri Jun 05 13:57:06 PDT 2009
+mZxid = 6
+mtime = Fri Jun 05 14:01:52 PDT 2009
+pZxid = 5
+cversion = 0
+dataVersion = 1
+aclVersion = 0
+ephemeralOwner = 0
+dataLength = 4
+numChildren = 0
+[zkshell: 15] get /zk_test
+junk
+cZxid = 5
+ctime = Fri Jun 05 13:57:06 PDT 2009
+mZxid = 6
+mtime = Fri Jun 05 14:01:52 PDT 2009
+pZxid = 5
+cversion = 0
+dataVersion = 1
+aclVersion = 0
+ephemeralOwner = 0
+dataLength = 4
+numChildren = 0
+]]>      </programlisting>
+      <para>
+       (Notice we did a <command>get</command> after setting the data and it did, indeed, change.</para>
+      <para>Finally, let's <command>delete</command> the node by issuing:
+      </para>
+      <programlisting>
+<![CDATA[
+[zkshell: 16] delete /zk_test
+[zkshell: 17] ls /
+[zookeeper]
+[zkshell: 18]
+]]></programlisting>
+      <para>That's it for now.  To explore more, continue with the rest of this document and see the <ulink url="zookeeperProgrammers.html">Programmer's Guide</ulink>. </para>
+    </section>
+
+    <section id="sc_ProgrammingToZooKeeper">
+      <title>Programming to ZooKeeper</title>
+
+      <para>ZooKeeper has a Java bindings and C bindings. They are
+      functionally equivalent. The C bindings exist in two variants: single
+      threaded and multi-threaded. These differ only in how the messaging loop
+      is done. For more information, see the <ulink
+      url="zookeeperProgrammers.html#ch_programStructureWithExample">Programming
+      Examples in the ZooKeeper Programmer's Guide</ulink> for
+      sample code using of the different APIs.</para>
+    </section>
+
+    <section id="sc_RunningReplicatedZooKeeper">
+      <title>Running Replicated ZooKeeper</title>
+
+      <para>Running ZooKeeper in standalone mode is convenient for evaluation,
+      some development, and testing. But in production, you should run
+      ZooKeeper in replicated mode. A replicated group of servers in the same
+      application is called a <emphasis>quorum</emphasis>, and in replicated
+      mode, all servers in the quorum have copies of the same configuration
+      file.</para>
+   <note>
+      <para>
+         For replicated mode, a minimum of three servers are required,
+         and it is strongly recommended that you have an odd number of
+         servers. If you only have two servers, then you are in a
+         situation where if one of them fails, there are not enough
+         machines to form a majority quorum. Two servers is inherently
+         <emphasis role="bold">less</emphasis>
+         stable than a single server, because there are two single
+         points of failure.
+      </para>
+   </note>
+   <para>
+      The required
+      <emphasis role="bold">conf/zoo.cfg</emphasis>
+      file for replicated mode is similar to the one used in standalone
+      mode, but with a few differences. Here is an example:
+   </para>
+
+<programlisting>
+tickTime=2000
+dataDir=/var/lib/zookeeper
+clientPort=2181
+initLimit=5
+syncLimit=2
+server.1=zoo1:2888:3888
+server.2=zoo2:2888:3888
+server.3=zoo3:2888:3888
+</programlisting>
+
+      <para>The new entry, <emphasis role="bold">initLimit</emphasis> is
+      timeouts ZooKeeper uses to limit the length of time the ZooKeeper
+      servers in quorum have to connect to a leader. The entry <emphasis
+      role="bold">syncLimit</emphasis> limits how far out of date a server can
+      be from a leader.</para>
+
+      <para>With both of these timeouts, you specify the unit of time using
+      <emphasis role="bold">tickTime</emphasis>. In this example, the timeout
+      for initLimit is 5 ticks at 2000 milleseconds a tick, or 10
+      seconds.</para>
+
+      <para>The entries of the form <emphasis>server.X</emphasis> list the
+      servers that make up the ZooKeeper service. When the server starts up,
+      it knows which server it is by looking for the file
+      <emphasis>myid</emphasis> in the data directory. That file has the 
+      contains the server number, in ASCII.</para>
+
+       <para>Finally, note the two port numbers after each server
+       name: " 2888" and "3888". Peers use the former port to connect
+       to other peers. Such a connection is necessary so that peers
+       can communicate, for example, to agree upon the order of
+       updates. More specifically, a ZooKeeper server uses this port
+       to connect followers to the leader. When a new leader arises, a
+       follower opens a TCP connection to the leader using this
+       port. Because the default leader election also uses TCP, we
+       currently require another port for leader election. This is the
+       second port in the server entry.
+       </para>
+
+      <note>
+        <para>If you want to test multiple servers on a single
+        machine, specify the servername
+        as <emphasis>localhost</emphasis> with unique quorum &amp;
+        leader election ports (i.e. 2888:3888, 2889:3889, 2890:3890 in
+        the example above) for each server.X in that server's config
+        file. Of course separate <emphasis>dataDir</emphasis>s and
+        distinct <emphasis>clientPort</emphasis>s are also necessary
+        (in the above replicated example, running on a
+        single <emphasis>localhost</emphasis>, you would still have
+        three config files).</para>
+        <para>Please be aware that setting up multiple servers on a single
+            machine will not create any redundancy. If something were to
+            happen which caused the machine to die, all of the zookeeper
+            servers would be offline. Full redundancy requires that each
+            server have its own machine. It must be a completely separate
+            physical server. Multiple virtual machines on the same physical
+            host are still vulnerable to the complete failure of that host.</para>
+      </note>
+    </section>
+
+    <section>
+      <title>Other Optimizations</title>
+
+      <para>There are a couple of other configuration parameters that can
+      greatly increase performance:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>To get low latencies on updates it is important to
+          have a dedicated transaction log directory. By default
+          transaction logs are put in the same directory as the data
+          snapshots and <emphasis>myid</emphasis> file. The dataLogDir
+          parameters indicates a different directory to use for the
+          transaction logs.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis>[tbd: what is the other config param?]</emphasis></para>
+        </listitem>
+      </itemizedlist>
+    </section>
+  </section>
+</article>


[08/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml b/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
deleted file mode 100644
index 7668e6a..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-	<!--
-		Copyright 2002-2004 The Apache Software Foundation Licensed 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.
-	-->
-                        <!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-                        "http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_Quota">
-	<title>ZooKeeper Quota's Guide</title>
-	<subtitle>A Guide to Deployment and Administration</subtitle>
-	<articleinfo>
-		<legalnotice>
-			<para>
-				Licensed 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
-				<ulink url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0
-				</ulink>
-				.
-			</para>
-			<para>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.</para>
-		</legalnotice>
-		<abstract>
-			<para>This document contains information about deploying,
-				administering and mantaining ZooKeeper. It also discusses best
-				practices and common problems.</para>
-		</abstract>
-	</articleinfo>
-	<section id="zookeeper_quotas">
-	<title>Quotas</title>
-	<para> ZooKeeper has both namespace and bytes quotas. You can use the ZooKeeperMain class to setup quotas.
-	ZooKeeper prints <emphasis>WARN</emphasis> messages if users exceed the quota assigned to them. The messages 
-	are printed in the log of the ZooKeeper. 
-	</para>
-	<para><computeroutput>$ bin/zkCli.sh -server host:port</computeroutput></para>
-	 <para> The above command gives you a command line option of using quotas.</para>
-	 <section>
-	 <title>Setting Quotas</title>
-	<para>You can use 
-	 <emphasis>setquota</emphasis> to set a quota on a ZooKeeper node. It has an option of setting quota with
-	  -n (for namespace)
-	 and -b (for bytes). </para>
-	<para> The ZooKeeper quota are stored in ZooKeeper itself in /zookeeper/quota. To disable other people from
-	changing the quota's set the ACL for /zookeeper/quota such that only admins are able to read and write to it.
-	</para>
-	</section>
-	<section>
-	<title>Listing Quotas</title>
-	<para> You can use
-	<emphasis>listquota</emphasis> to list a quota on a ZooKeeper node.
-	</para>
-	</section>
-	<section>
-	<title> Deleting Quotas</title>
-	<para> You can use
-	<emphasis>delquota</emphasis> to delete quota on a ZooKeeper node.
-	</para>
-	</section>
-	</section>
-	</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperReconfig.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperReconfig.xml b/src/docs/src/documentation/content/xdocs/zookeeperReconfig.xml
deleted file mode 100644
index aa6419e..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperReconfig.xml
+++ /dev/null
@@ -1,878 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="ar_reconfig">
-  <title>ZooKeeper Dynamic Reconfiguration</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This document contains information about Dynamic Reconfiguration in
-        ZooKeeper.</para>
-    </abstract>
-  </articleinfo>
-  <section id="ch_reconfig_intro">
-    <title>Overview</title>
-    <para>Prior to the 3.5.0 release, the membership and all other configuration
-      parameters of Zookeeper were static - loaded during boot and immutable at
-      runtime. Operators resorted to ''rolling restarts'' - a manually intensive
-      and error-prone method of changing the configuration that has caused data
-      loss and inconsistency in production.</para>
-    <para>Starting with 3.5.0, “rolling restarts” are no longer needed!
-      ZooKeeper comes with full support for automated configuration changes: the
-      set of Zookeeper servers, their roles (participant / observer), all ports,
-      and even the quorum system can be changed dynamically, without service
-      interruption and while maintaining data consistency. Reconfigurations are
-      performed immediately, just like other operations in ZooKeeper. Multiple
-      changes can be done using a single reconfiguration command. The dynamic
-      reconfiguration functionality does not limit operation concurrency, does
-      not require client operations to be stopped during reconfigurations, has a
-      very simple interface for administrators and no added complexity to other
-      client operations.</para>
-    <para>New client-side features allow clients to find out about configuration
-      changes and to update the connection string (list of servers and their
-      client ports) stored in their ZooKeeper handle. A probabilistic algorithm
-      is used to rebalance clients across the new configuration servers while
-      keeping the extent of client migrations proportional to the change in
-      ensemble membership.</para>
-    <para>This document provides the administrator manual for reconfiguration.
-      For a detailed description of the reconfiguration algorithms, performance
-      measurements, and more, please see our paper:</para>
-    <variablelist>
-      <varlistentry>
-        <term>Shraer, A., Reed, B., Malkhi, D., Junqueira, F. Dynamic
-          Reconfiguration of Primary/Backup Clusters. In <emphasis>USENIX Annual
-          Technical Conference (ATC) </emphasis>(2012), 425-437</term>
-        <listitem>
-          <para>Links: <ulink
-            url="https://www.usenix.org/system/files/conference/atc12/atc12-final74.pdf"
-            >paper (pdf)</ulink>, <ulink
-            url="https://www.usenix.org/sites/default/files/conference/protected-files/shraer_atc12_slides.pdf"
-            >slides (pdf)</ulink>, <ulink
-            url="https://www.usenix.org/conference/atc12/technical-sessions/presentation/shraer"
-            >video</ulink>, <ulink
-            url="http://www.slideshare.net/Hadoop_Summit/dynamic-reconfiguration-of-zookeeper"
-            >hadoop summit slides</ulink></para>
-        </listitem>
-      </varlistentry>
-    </variablelist>
-    <para><emphasis role="bold">Note:</emphasis> Starting with 3.5.3, the dynamic reconfiguration
-      feature is disabled by default, and has to be explicitly turned on via
-      <ulink url="zookeeperAdmin.html#sc_advancedConfiguration">
-        reconfigEnabled </ulink> configuration option.
-    </para>
-  </section>
-  <section id="ch_reconfig_format">
-    <title>Changes to Configuration Format</title>
-    <section id="sc_reconfig_clientport">
-      <title>Specifying the client port</title>
-      <para>A client port of a server is the port on which the server accepts
-        client connection requests. Starting with 3.5.0 the
-        <emphasis>clientPort</emphasis> and <emphasis>clientPortAddress
-        </emphasis> configuration parameters should no longer be used. Instead,
-        this information is now part of the server keyword specification, which
-        becomes as follows:</para>
-      <para><computeroutput><![CDATA[server.<positive id> = <address1>:<port1>:<port2>[:role];[<client port address>:]<client port>]]></computeroutput></para>
-      <para>The client port specification is to the right of the semicolon. The
-        client port address is optional, and if not specified it defaults to
-        "0.0.0.0". As usual, role is also optional, it can be
-        <emphasis>participant</emphasis> or <emphasis>observer</emphasis>
-        (<emphasis>participant</emphasis> by default).</para>
-      <para> Examples of legal server statements: </para>
-      <itemizedlist>
-        <listitem>
-          <para><computeroutput>server.5 = 125.23.63.23:1234:1235;1236</computeroutput></para>
-        </listitem>
-        <listitem>
-          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:participant;1236</computeroutput></para>
-        </listitem>
-        <listitem>
-          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:observer;1236</computeroutput></para>
-        </listitem>
-        <listitem>
-          <para><computeroutput>server.5 = 125.23.63.23:1234:1235;125.23.63.24:1236</computeroutput></para>
-        </listitem>
-        <listitem>
-          <para><computeroutput>server.5 = 125.23.63.23:1234:1235:participant;125.23.63.23:1236</computeroutput></para>
-        </listitem>
-      </itemizedlist>
-    </section>
-    <section id="sc_reconfig_standaloneEnabled">
-      <title>The <emphasis>standaloneEnabled</emphasis> flag</title>
-      <para>Prior to 3.5.0, one could run ZooKeeper in Standalone mode or in a
-        Distributed mode. These are separate implementation stacks, and
-        switching between them during run time is not possible. By default (for
-        backward compatibility) <emphasis>standaloneEnabled</emphasis> is set to
-        <emphasis>true</emphasis>. The consequence of using this default is that
-        if started with a single server the ensemble will not be allowed to
-        grow, and if started with more than one server it will not be allowed to
-        shrink to contain fewer than two participants.</para>
-      <para>Setting the flag to <emphasis>false</emphasis> instructs the system
-        to run the Distributed software stack even if there is only a single
-        participant in the ensemble. To achieve this the (static) configuration
-        file should contain:</para>
-      <para><computeroutput>standaloneEnabled=false</computeroutput></para>
-      <para>With this setting it is possible to start a ZooKeeper ensemble
-        containing a single participant and to dynamically grow it by adding
-        more servers. Similarly, it is possible to shrink an ensemble so that
-        just a single participant remains, by removing servers.</para>
-      <para>Since running the Distributed mode allows more flexibility, we
-        recommend setting the flag to <emphasis>false</emphasis>. We expect that
-        the legacy Standalone mode will be deprecated in the future.</para>
-    </section>
-    <section id="sc_reconfig_reconfigEnabled">
-      <title>The <emphasis>reconfigEnabled</emphasis> flag</title>
-      <para>Starting with 3.5.0 and prior to 3.5.3, there is no way to disable
-        dynamic reconfiguration feature. We would like to offer the option of
-        disabling reconfiguration feature because with reconfiguration enabled,
-        we have a security concern that a malicious actor can make arbitrary changes
-        to the configuration of a ZooKeeper ensemble, including adding a compromised
-        server to the ensemble. We prefer to leave to the discretion of the user to
-        decide whether to enable it or not and make sure that the appropriate security
-        measure are in place. So in 3.5.3 the <ulink url="zookeeperAdmin.html#sc_advancedConfiguration">
-          reconfigEnabled </ulink> configuration option is introduced
-        such that the reconfiguration feature can be completely disabled and any attempts
-        to reconfigure a cluster through reconfig API with or without authentication
-        will fail by default, unless <emphasis role="bold">reconfigEnabled</emphasis> is set to
-        <emphasis role="bold">true</emphasis>.
-      </para>
-      <para>To set the option to true, the configuration file (zoo.cfg) should contain:</para>
-      <para><computeroutput>reconfigEnabled=true</computeroutput></para>
-    </section>
-    <section id="sc_reconfig_file">
-      <title>Dynamic configuration file</title>
-      <para>Starting with 3.5.0 we're distinguishing between dynamic
-        configuration parameters, which can be changed during runtime, and
-        static configuration parameters, which are read from a configuration
-        file when a server boots and don't change during its execution. For now,
-        the following configuration keywords are considered part of the dynamic
-        configuration: <emphasis>server</emphasis>, <emphasis>group</emphasis>
-        and <emphasis>weight</emphasis>.</para>
-      <para>Dynamic configuration parameters are stored in a separate file on
-        the server (which we call the dynamic configuration file). This file is
-        linked from the static config file using the new
-        <emphasis>dynamicConfigFile</emphasis> keyword.</para>
-      <para><emphasis role="bold">Example</emphasis></para>
-      <example>
-        <title>zoo_replicated1.cfg</title>
-        <programlisting>tickTime=2000
-dataDir=/zookeeper/data/zookeeper1
-initLimit=5
-syncLimit=2
-dynamicConfigFile=/zookeeper/conf/zoo_replicated1.cfg.dynamic</programlisting>
-      </example>
-      <example>
-        <title>zoo_replicated1.cfg.dynamic</title>
-        <programlisting>server.1=125.23.63.23:2780:2783:participant;2791
-server.2=125.23.63.24:2781:2784:participant;2792
-server.3=125.23.63.25:2782:2785:participant;2793</programlisting>
-      </example>
-      <para>When the ensemble configuration changes, the static configuration
-        parameters remain the same. The dynamic parameters are pushed by
-        ZooKeeper and overwrite the dynamic configuration files on all servers.
-        Thus, the dynamic configuration files on the different servers are
-        usually identical (they can only differ momentarily when a
-        reconfiguration is in progress, or if a new configuration hasn't
-        propagated yet to some of the servers). Once created, the dynamic
-        configuration file should not be manually altered. Changed are only made
-        through the new reconfiguration commands outlined below. Note that
-        changing the config of an offline cluster could result in an
-        inconsistency with respect to configuration information stored in the
-        ZooKeeper log (and the special configuration znode, populated from the
-        log) and is therefore highly discouraged.</para>
-      <para><emphasis role="bold">Example 2</emphasis></para>
-      <para>Users may prefer to initially specify a single configuration file.
-        The following is thus also legal:</para>
-      <example>
-        <title>zoo_replicated1.cfg</title>
-        <programlisting>tickTime=2000
-dataDir=/zookeeper/data/zookeeper1
-initLimit=5
-syncLimit=2
-clientPort=<emphasis role="bold">2791</emphasis>  // note that this line is now redundant and therefore not recommended
-server.1=125.23.63.23:2780:2783:participant;<emphasis role="bold">2791</emphasis>
-server.2=125.23.63.24:2781:2784:participant;2792
-server.3=125.23.63.25:2782:2785:participant;2793</programlisting>
-      </example>
-      <para>The configuration files on each server will be automatically split
-        into dynamic and static files, if they are not already in this format.
-        So the configuration file above will be automatically transformed into
-        the two files in Example 1. Note that the clientPort and
-        clientPortAddress lines (if specified) will be automatically removed
-        during this process, if they are redundant (as in the example above).
-        The original static configuration file is backed up (in a .bak
-        file).</para>
-    </section>
-    <section id="sc_reconfig_backward">
-      <title>Backward compatibility</title>
-      <para>We still support the old configuration format. For example, the
-        following configuration file is acceptable (but not recommended):</para>
-      <example>
-        <title>zoo_replicated1.cfg</title>
-        <programlisting>tickTime=2000
-dataDir=/zookeeper/data/zookeeper1
-initLimit=5
-syncLimit=2
-clientPort=2791
-server.1=125.23.63.23:2780:2783:participant
-server.2=125.23.63.24:2781:2784:participant
-server.3=125.23.63.25:2782:2785:participant</programlisting>
-      </example>
-      <para>During boot, a dynamic configuration file is created and contains
-        the dynamic part of the configuration as explained earlier. In this
-        case, however, the line "clientPort=2791" will remain in the static
-        configuration file of server 1 since it is not redundant -- it was not
-        specified as part of the "server.1=..." using the format explained in
-        the section <xref linkend="ch_reconfig_format"/>. If a reconfiguration
-        is invoked that sets the client port of server 1, we remove
-        "clientPort=2791" from the static configuration file (the dynamic file
-        now contain this information as part of the specification of server
-        1).</para>
-    </section>
-  </section>
-  <section id="ch_reconfig_upgrade">
-    <title>Upgrading to 3.5.0</title>
-    <para>Upgrading a running ZooKeeper ensemble to 3.5.0 should be done only
-      after upgrading your ensemble to the 3.4.6 release. Note that this is only
-      necessary for rolling upgrades (if you're fine with shutting down the
-      system completely, you don't have to go through 3.4.6). If you attempt a
-      rolling upgrade without going through 3.4.6 (for example from 3.4.5), you
-      may get the following error:</para>
-    <programlisting>2013-01-30 11:32:10,663 [myid:2] - INFO [localhost/127.0.0.1:2784:QuorumCnxManager$Listener@498] - Received connection request /127.0.0.1:60876
-2013-01-30 11:32:10,663 [myid:2] - WARN [localhost/127.0.0.1:2784:QuorumCnxManager@349] - Invalid server id: -65536</programlisting>
-    <para>During a rolling upgrade, each server is taken down in turn and
-      rebooted with the new 3.5.0 binaries. Before starting the server with
-      3.5.0 binaries, we highly recommend updating the configuration file so
-      that all server statements "server.x=..." contain client ports (see the
-      section <xref linkend="sc_reconfig_clientport"/>). As explained earlier
-      you may leave the configuration in a single file, as well as leave the
-      clientPort/clientPortAddress statements (although if you specify client
-      ports in the new format, these statements are now redundant).</para>
-  </section>
-
-  <section id="ch_reconfig_dyn">
-    <title>Dynamic Reconfiguration of the ZooKeeper Ensemble</title>
-    <para>The ZooKeeper Java and C API were extended with getConfig and reconfig
-      commands that facilitate reconfiguration. Both commands have a synchronous
-      (blocking) variant and an asynchronous one. We demonstrate these commands
-      here using the Java CLI, but note that you can similarly use the C CLI or
-      invoke the commands directly from a program just like any other ZooKeeper
-      command.</para>
-
-    <section id="ch_reconfig_api">
-      <title>API</title>
-      <para>There are two sets of APIs for both Java and C client.
-      </para>
-      <variablelist>
-        <varlistentry>
-          <term><emphasis role="bold">Reconfiguration API</emphasis></term>
-
-          <listitem>
-            <para>Reconfiguration API is used to reconfigure the ZooKeeper cluster.
-              Starting with 3.5.3, reconfiguration Java APIs are moved into ZooKeeperAdmin class
-              from ZooKeeper class, and use of this API requires ACL setup and user
-              authentication (see <xref linkend="sc_reconfig_access_control"/> for more information.).
-            </para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term><emphasis role="bold">Get Configuration API</emphasis></term>
-          <listitem>
-            <para>Get configuration APIs are used to retrieve ZooKeeper cluster configuration information
-              stored in /zookeeper/config znode. Use of this API does not require specific setup or authentication,
-            because /zookeeper/config is readable to any users.</para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-    </section>
-
-    <section id="sc_reconfig_access_control">
-      <title>Security</title>
-      <para>Prior to <emphasis role="bold">3.5.3</emphasis>, there is no enforced security mechanism
-        over reconfig so any ZooKeeper clients that can connect to ZooKeeper server ensemble
-        will have the ability to change the state of a ZooKeeper cluster via reconfig.
-        It is thus possible for a malicious client to add compromised server to an ensemble,
-        e.g., add a compromised server, or remove legitimate servers.
-        Cases like these could be security vulnerabilities on a case by case basis.
-      </para>
-      <para>To address this security concern, we introduced access control over reconfig
-        starting from <emphasis role="bold">3.5.3</emphasis> such that only a specific set of users
-        can use reconfig commands or APIs, and these users need be configured explicitly. In addition,
-        the setup of ZooKeeper cluster must enable authentication so ZooKeeper clients can be authenticated.
-      </para>
-      <para>
-        We also provides an escape hatch for users who operate and interact with a ZooKeeper ensemble in a secured
-        environment (i.e. behind company firewall). For those users who want to use reconfiguration feature but
-        don't want the overhead of configuring an explicit list of authorized user for reconfig access checks,
-        they can set <ulink url="zookeeperAdmin.html#sc_authOptions">"skipACL"</ulink> to "yes" which will
-        skip ACL check and allow any user to reconfigure cluster.
-      </para>
-      <para>
-        Overall, ZooKeeper provides flexible configuration options for the reconfigure feature
-        that allow a user to choose based on user's security requirement.
-        We leave to the discretion of the user to decide appropriate security measure are in place.
-      </para>
-      <variablelist>
-        <varlistentry>
-          <term><emphasis role="bold">Access Control</emphasis></term>
-
-          <listitem>
-            <para>The dynamic configuration is stored in a special znode
-              ZooDefs.CONFIG_NODE = /zookeeper/config. This node by default is read only
-              for all users, except super user and users that's explicitly configured for write
-              access.
-            </para>
-
-            <para>Clients that need to use reconfig commands or reconfig API should be configured as users
-              that have write access to CONFIG_NODE. By default, only the super user has full control including
-              write access to CONFIG_NODE. Additional users can be granted write access through superuser
-              by setting an ACL that has write permission associated with specified user.
-            </para>
-
-            <para>A few examples of how to setup ACLs and use reconfiguration API with authentication can be found in
-              ReconfigExceptionTest.java and TestReconfigServer.cc.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term><emphasis role="bold">Authentication</emphasis></term>
-
-          <listitem>
-            <para>Authentication of users is orthogonal to the access control and is delegated to
-              existing authentication mechanism supported by ZooKeeper's pluggable authentication schemes.
-              See <ulink
-                      url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zookeeper+and+SASL"
-              >ZooKeeper and SASL</ulink> for more details on this topic.
-            </para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term><emphasis role="bold">Disable ACL check</emphasis></term>
-          <listitem>
-            <para>
-              ZooKeeper supports <ulink
-                    url="zookeeperAdmin.html#sc_authOptions">"skipACL"</ulink> option such that ACL
-              check will be completely skipped, if skipACL is set to "yes". In such cases any unauthenticated
-              users can use reconfig API.
-            </para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-    </section>
-
-    <section id="sc_reconfig_retrieving">
-      <title>Retrieving the current dynamic configuration</title>
-      <para>The dynamic configuration is stored in a special znode
-        ZooDefs.CONFIG_NODE = /zookeeper/config. The new
-        <command>config</command> CLI command reads this znode (currently it is
-        simply a wrapper to <command>get /zookeeper/config</command>). As with
-        normal reads, to retrieve the latest committed value you should do a
-        <command>sync</command> first.</para>
-      <programlisting>[zk: 127.0.0.1:2791(CONNECTED) 3] config
-server.1=localhost:2780:2783:participant;localhost:2791
-server.2=localhost:2781:2784:participant;localhost:2792
-server.3=localhost:2782:2785:participant;localhost:2793
-<emphasis role="bold">version=400000003</emphasis></programlisting>
-      <para>Notice the last line of the output. This is the configuration
-        version. The version equals to the zxid of the reconfiguration command
-        which created this configuration. The version of the first established
-        configuration equals to the zxid of the NEWLEADER message sent by the
-        first successfully established leader. When a configuration is written
-        to a dynamic configuration file, the version automatically becomes part
-        of the filename and the static configuration file is updated with the
-        path to the new dynamic configuration file. Configuration files
-        corresponding to earlier versions are retained for backup
-        purposes.</para>
-      <para>During boot time the version (if it exists) is extracted from the
-        filename. The version should never be altered manually by users or the
-        system administrator. It is used by the system to know which
-        configuration is most up-to-date. Manipulating it manually can result in
-        data loss and inconsistency.</para>
-      <para>Just like a <command>get</command> command, the
-        <command>config</command> CLI command accepts the <option>-w</option>
-        flag for setting a watch on the znode, and <option>-s</option> flag for
-        displaying the Stats of the znode. It additionally accepts a new flag
-        <option>-c</option> which outputs only the version and the client
-        connection string corresponding to the current configuration. For
-        example, for the configuration above we would get:</para>
-      <programlisting>[zk: 127.0.0.1:2791(CONNECTED) 17] config -c
-400000003 localhost:2791,localhost:2793,localhost:2792</programlisting>
-      <para>Note that when using the API directly, this command is called
-        <command>getConfig</command>.</para>
-      <para>As any read command it returns the configuration known to the
-        follower to which your client is connected, which may be slightly
-        out-of-date. One can use the <command>sync</command> command for
-        stronger guarantees. For example using the Java API:</para>
-      <programlisting>zk.sync(ZooDefs.CONFIG_NODE, void_callback, context);
-zk.getConfig(watcher, callback, context);</programlisting>
-      <para>Note: in 3.5.0 it doesn't really matter which path is passed to the
-        <command>sync() </command> command as all the server's state is brought
-        up to date with the leader (so one could use a different path instead of
-        ZooDefs.CONFIG_NODE). However, this may change in the future.</para>
-    </section>
-    <section id="sc_reconfig_modifying">
-      <title>Modifying the current dynamic configuration</title>
-      <para>Modifying the configuration is done through the
-        <command>reconfig</command> command. There are two modes of
-        reconfiguration: incremental and non-incremental (bulk). The
-        non-incremental simply specifies the new dynamic configuration of the
-        system. The incremental specifies changes to the current configuration.
-        The <command>reconfig</command> command returns the new
-        configuration.</para>
-      <para>A few examples are in: <filename>ReconfigTest.java</filename>,
-        <filename>ReconfigRecoveryTest.java</filename> and
-        <filename>TestReconfigServer.cc</filename>.</para>
-      <section id="sc_reconfig_general">
-        <title>General</title>
-        <para><emphasis role="bold">Removing servers:</emphasis> Any server can
-          be removed, including the leader (although removing the leader will
-          result in a short unavailability, see Figures 6 and 8 in the <ulink
-          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
-          >paper</ulink>). The server will not be shut-down automatically.
-          Instead, it becomes a "non-voting follower". This is somewhat similar
-          to an observer in that its votes don't count towards the Quorum of
-          votes necessary to commit operations. However, unlike a non-voting
-          follower, an observer doesn't actually see any operation proposals and
-          does not ACK them. Thus a non-voting follower has a more significant
-          negative effect on system throughput compared to an observer.
-          Non-voting follower mode should only be used as a temporary mode,
-          before shutting the server down, or adding it as a follower or as an
-          observer to the ensemble. We do not shut the server down automatically
-          for two main reasons. The first reason is that we do not want all the
-          clients connected to this server to be immediately disconnected,
-          causing a flood of connection requests to other servers. Instead, it
-          is better if each client decides when to migrate independently. The
-          second reason is that removing a server may sometimes (rarely) be
-          necessary in order to change it from "observer" to "participant" (this
-          is explained in the section <xref linkend="sc_reconfig_additional"
-          />).</para>
-        <para>Note that the new configuration should have some minimal number of
-          participants in order to be considered legal. If the proposed change
-          would leave the cluster with less than 2 participants and standalone
-          mode is enabled (standaloneEnabled=true, see the section <xref
-          linkend="sc_reconfig_standaloneEnabled"/>), the reconfig will not be
-          processed (BadArgumentsException). If standalone mode is disabled
-          (standaloneEnabled=false) then its legal to remain with 1 or more
-          participants.</para>
-        <para><emphasis role="bold">Adding servers:</emphasis> Before a
-          reconfiguration is invoked, the administrator must make sure that a
-          quorum (majority) of participants from the new configuration are
-          already connected and synced with the current leader. To achieve this
-          we need to connect a new joining server to the leader before it is
-          officially part of the ensemble. This is done by starting the joining
-          server using an initial list of servers which is technically not a
-          legal configuration of the system but (a) contains the joiner, and (b)
-          gives sufficient information to the joiner in order for it to find and
-          connect to the current leader. We list a few different options of
-          doing this safely.</para>
-        <orderedlist>
-          <listitem>
-            <para>Initial configuration of joiners is comprised of servers in
-              the last committed configuration and one or more joiners, where
-              <emphasis role="bold">joiners are listed as observers.</emphasis>
-              For example, if servers D and E are added at the same time to (A,
-              B, C) and server C is being removed, the initial configuration of
-              D could be (A, B, C, D) or (A, B, C, D, E), where D and E are
-              listed as observers. Similarly, the configuration of E could be
-              (A, B, C, E) or (A, B, C, D, E), where D and E are listed as
-              observers. <emphasis role="bold">Note that listing the joiners as
-              observers will not actually make them observers - it will only
-              prevent them from accidentally forming a quorum with other
-              joiners.</emphasis> Instead, they will contact the servers in the
-              current configuration and adopt the last committed configuration
-              (A, B, C), where the joiners are absent. Configuration files of
-              joiners are backed up and replaced automatically as this happens.
-              After connecting to the current leader, joiners become non-voting
-              followers until the system is reconfigured and they are added to
-              the ensemble (as participant or observer, as appropriate).</para>
-          </listitem>
-          <listitem>
-            <para>Initial configuration of each joiner is comprised of servers
-              in the last committed configuration + <emphasis role="bold">the
-              joiner itself, listed as a participant.</emphasis> For example, to
-              add a new server D to a configuration consisting of servers (A, B,
-              C), the administrator can start D using an initial configuration
-              file consisting of servers (A, B, C, D). If both D and E are added
-              at the same time to (A, B, C), the initial configuration of D
-              could be (A, B, C, D) and the configuration of E could be (A, B,
-              C, E). Similarly, if D is added and C is removed at the same time,
-              the initial configuration of D could be (A, B, C, D). Never list
-              more than one joiner as participant in the initial configuration
-              (see warning below).</para>
-          </listitem>
-          <listitem>
-            <para>Whether listing the joiner as an observer or as participant,
-              it is also fine not to list all the current configuration servers,
-              as long as the current leader is in the list. For example, when
-              adding D we could start D with a configuration file consisting of
-              just (A, D) if A is the current leader. however this is more
-              fragile since if A fails before D officially joins the ensemble, D
-              doesn’t know anyone else and therefore the administrator will have
-              to intervene and restart D with another server list.</para>
-          </listitem>
-        </orderedlist>
-        <note>
-          <title>Warning</title>
-          <para>Never specify more than one joining server in the same initial
-            configuration as participants. Currently, the joining servers don’t
-            know that they are joining an existing ensemble; if multiple joiners
-            are listed as participants they may form an independent quorum
-            creating a split-brain situation such as processing operations
-            independently from your main ensemble. It is OK to list multiple
-            joiners as observers in an initial config.</para>
-        </note>
-        <para>If the configuration of existing servers changes or they become unavailable
-          before the joiner succeeds to connect and learn obout configuration changes, the
-          joiner may need to be restarted with an updated configuration file in order to be
-          able to connect.</para>
-        <para>Finally, note that once connected to the leader, a joiner adopts
-          the last committed configuration, in which it is absent (the initial
-          config of the joiner is backed up before being rewritten). If the
-          joiner restarts in this state, it will not be able to boot since it is
-          absent from its configuration file. In order to start it you’ll once
-          again have to specify an initial configuration.</para>
-        <para><emphasis role="bold">Modifying server parameters:</emphasis> One
-          can modify any of the ports of a server, or its role
-          (participant/observer) by adding it to the ensemble with different
-          parameters. This works in both the incremental and the bulk
-          reconfiguration modes. It is not necessary to remove the server and
-          then add it back; just specify the new parameters as if the server is
-          not yet in the system. The server will detect the configuration change
-          and perform the necessary adjustments. See an example in the section
-          <xref linkend="sc_reconfig_incremental"/> and an exception to this
-          rule in the section <xref linkend="sc_reconfig_additional"/>.</para>
-        <para>It is also possible to change the Quorum System used by the
-          ensemble (for example, change the Majority Quorum System to a
-          Hierarchical Quorum System on the fly). This, however, is only allowed
-          using the bulk (non-incremental) reconfiguration mode. In general,
-          incremental reconfiguration only works with the Majority Quorum
-          System. Bulk reconfiguration works with both Hierarchical and Majority
-          Quorum Systems.</para>
-        <para><emphasis role="bold">Performance Impact:</emphasis> There is
-          practically no performance impact when removing a follower, since it
-          is not being automatically shut down (the effect of removal is that
-          the server's votes are no longer being counted). When adding a server,
-          there is no leader change and no noticeable performance disruption.
-          For details and graphs please see Figures 6, 7 and 8 in the <ulink
-          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
-          >paper</ulink>.</para>
-        <para>The most significant disruption will happen when a leader change
-          is caused, in one of the following cases:</para>
-        <orderedlist>
-          <listitem>
-            <para>Leader is removed from the ensemble.</para>
-          </listitem>
-          <listitem>
-            <para>Leader's role is changed from participant to observer.</para>
-          </listitem>
-          <listitem>
-            <para>The port used by the leader to send transactions to others
-              (quorum port) is modified.</para>
-          </listitem>
-        </orderedlist>
-        <para>In these cases we perform a leader hand-off where the old leader
-          nominates a new leader. The resulting unavailability is usually
-          shorter than when a leader crashes since detecting leader failure is
-          unnecessary and electing a new leader can usually be avoided during a
-          hand-off (see Figures 6 and 8 in the <ulink
-          url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
-          >paper</ulink>).</para>
-        <para>When the client port of a server is modified, it does not drop
-          existing client connections. New connections to the server will have
-          to use the new client port.</para>
-        <para><emphasis role="bold">Progress guarantees:</emphasis> Up to the
-          invocation of the reconfig operation, a quorum of the old
-          configuration is required to be available and connected for ZooKeeper
-          to be able to make progress. Once reconfig is invoked, a quorum of
-          both the old and of the new configurations must be available. The
-          final transition happens once (a) the new configuration is activated,
-          and (b) all operations scheduled before the new configuration is
-          activated by the leader are committed. Once (a) and (b) happen, only a
-          quorum of the new configuration is required. Note, however, that
-          neither (a) nor (b) are visible to a client. Specifically, when a
-          reconfiguration operation commits, it only means that an activation
-          message was sent out by the leader. It does not necessarily mean that
-          a quorum of the new configuration got this message (which is required
-          in order to activate it) or that (b) has happened. If one wants to
-          make sure that both (a) and (b) has already occurred (for example, in
-          order to know that it is safe to shut down old servers that were
-          removed), one can simply invoke an update
-          (<command>set-data</command>, or some other quorum operation, but not
-          a <command>sync</command>) and wait for it to commit. An alternative
-          way to achieve this was to introduce another round to the
-          reconfiguration protocol (which, for simplicity and compatibility with
-          Zab, we decided to avoid).</para>
-      </section>
-      <section id="sc_reconfig_incremental">
-        <title>Incremental mode</title>
-        <para>The incremental mode allows adding and removing servers to the
-          current configuration. Multiple changes are allowed. For
-          example:</para>
-        <para><userinput>&gt; reconfig -remove 3 -add
-          server.5=125.23.63.23:1234:1235;1236</userinput></para>
-        <para>Both the add and the remove options get a list of comma separated
-          arguments (no spaces):</para>
-        <para><userinput>&gt; reconfig -remove 3,4 -add
-          server.5=localhost:2111:2112;2113,6=localhost:2114:2115:observer;2116</userinput></para>
-        <para>The format of the server statement is exactly the same as
-          described in the section <xref linkend="sc_reconfig_clientport"/> and
-          includes the client port. Notice that here instead of "server.5=" you
-          can just say "5=". In the example above, if server 5 is already in the
-          system, but has different ports or is not an observer, it is updated
-          and once the configuration commits becomes an observer and starts
-          using these new ports. This is an easy way to turn participants into
-          observers and vise versa or change any of their ports, without
-          rebooting the server.</para>
-        <para>ZooKeeper supports two types of Quorum Systems – the simple
-          Majority system (where the leader commits operations after receiving
-          ACKs from a majority of voters) and a more complex Hierarchical
-          system, where votes of different servers have different weights and
-          servers are divided into voting groups. Currently, incremental
-          reconfiguration is allowed only if the last proposed configuration
-          known to the leader uses a Majority Quorum System
-          (BadArgumentsException is thrown otherwise).</para>
-        <para>Incremental mode - examples using the Java API:</para>
-        <programlisting><![CDATA[List<String> leavingServers = new ArrayList<String>();
-leavingServers.add("1");
-leavingServers.add("2");
-byte[] config = zk.reconfig(null, leavingServers, null, -1, new Stat());]]></programlisting>
-
-        <programlisting><![CDATA[List<String> leavingServers = new ArrayList<String>();
-List<String> joiningServers = new ArrayList<String>();
-leavingServers.add("1");
-joiningServers.add("server.4=localhost:1234:1235;1236");
-byte[] config = zk.reconfig(joiningServers, leavingServers, null, -1, new Stat());
-
-String configStr = new String(config);
-System.out.println(configStr);]]></programlisting>
-        <para>There is also an asynchronous API, and an API accepting comma
-          separated Strings instead of List&lt;String&gt;. See
-          src/java/main/org/apache/zookeeper/ZooKeeper.java.</para>
-      </section>
-      <section id="sc_reconfig_nonincremental">
-        <title>Non-incremental mode</title>
-        <para>The second mode of reconfiguration is non-incremental, whereby a
-          client gives a complete specification of the new dynamic system
-          configuration. The new configuration can either be given in place or
-          read from a file:</para>
-        <para><userinput>&gt; reconfig -file newconfig.cfg
-          </userinput>//newconfig.cfg is a dynamic config file, see <xref
-          linkend="sc_reconfig_file"/></para>
-        <para><userinput>&gt; reconfig -members
-          server.1=125.23.63.23:2780:2783:participant;2791,server.2=125.23.63.24:2781:2784:participant;2792,server.3=125.23.63.25:2782:2785:participant;2793</userinput></para>
-        <para>The new configuration may use a different Quorum System. For
-          example, you may specify a Hierarchical Quorum System even if the
-          current ensemble uses a Majority Quorum System.</para>
-        <para>Bulk mode - example using the Java API:</para>
-        <programlisting><![CDATA[List<String> newMembers = new ArrayList<String>();
-newMembers.add("server.1=1111:1234:1235;1236");
-newMembers.add("server.2=1112:1237:1238;1239");
-newMembers.add("server.3=1114:1240:1241:observer;1242");
-
-byte[] config = zk.reconfig(null, null, newMembers, -1, new Stat());
-
-String configStr = new String(config);
-System.out.println(configStr);]]></programlisting>
-        <para>There is also an asynchronous API, and an API accepting comma
-          separated String containing the new members instead of
-          List&lt;String&gt;. See
-          src/java/main/org/apache/zookeeper/ZooKeeper.java.</para>
-      </section>
-      <section id="sc_reconfig_conditional">
-        <title>Conditional reconfig</title>
-        <para>Sometimes (especially in non-incremental mode) a new proposed
-          configuration depends on what the client "believes" to be the current
-          configuration, and should be applied only to that configuration.
-          Specifically, the <command>reconfig</command> succeeds only if the
-          last configuration at the leader has the specified version.</para>
-        <para><userinput><![CDATA[> reconfig -file <filename> -v <version>]]></userinput></para>
-        <para>In the previously listed Java examples, instead of -1 one could
-          specify a configuration version to condition the
-          reconfiguration.</para>
-      </section>
-      <section id="sc_reconfig_errors">
-        <title>Error conditions</title>
-        <para>In addition to normal ZooKeeper error conditions, a
-          reconfiguration may fail for the following reasons:</para>
-        <orderedlist>
-          <listitem>
-            <para>another reconfig is currently in progress
-              (ReconfigInProgress)</para>
-          </listitem>
-          <listitem>
-            <para>the proposed change would leave the cluster with less than 2
-              participants, in case standalone mode is enabled, or, if
-              standalone mode is disabled then its legal to remain with 1 or
-              more participants (BadArgumentsException)</para>
-          </listitem>
-          <listitem>
-            <para>no quorum of the new configuration was connected and
-              up-to-date with the leader when the reconfiguration processing
-              began (NewConfigNoQuorum)</para>
-          </listitem>
-          <listitem>
-            <para><userinput>-v x</userinput> was specified, but the version
-              <userinput>y</userinput> of the latest configuration is not
-              <userinput>x</userinput> (BadVersionException)</para>
-          </listitem>
-          <listitem>
-            <para>an incremental reconfiguration was requested but the last
-              configuration at the leader uses a Quorum System which is
-              different from the Majority system (BadArgumentsException)</para>
-          </listitem>
-          <listitem>
-            <para>syntax error (BadArgumentsException)</para>
-          </listitem>
-          <listitem>
-            <para>I/O exception when reading the configuration from a file
-              (BadArgumentsException)</para>
-          </listitem>
-        </orderedlist>
-        <para>Most of these are illustrated by test-cases in
-          <filename>ReconfigFailureCases.java</filename>.</para>
-      </section>
-      <section id="sc_reconfig_additional">
-        <title>Additional comments</title>
-        <para><emphasis role="bold">Liveness:</emphasis> To better understand
-          the difference between incremental and non-incremental
-          reconfiguration, suppose that client C1 adds server D to the system
-          while a different client C2 adds server E. With the non-incremental
-          mode, each client would first invoke <command>config</command> to find
-          out the current configuration, and then locally create a new list of
-          servers by adding its own suggested server. The new configuration can
-          then be submitted using the non-incremental
-          <command>reconfig</command> command. After both reconfigurations
-          complete, only one of E or D will be added (not both), depending on
-          which client's request arrives second to the leader, overwriting the
-          previous configuration. The other client can repeat the process until
-          its change takes effect. This method guarantees system-wide progress
-          (i.e., for one of the clients), but does not ensure that every client
-          succeeds. To have more control C2 may request to only execute the
-          reconfiguration in case the version of the current configuration
-          hasn't changed, as explained in the section <xref
-          linkend="sc_reconfig_conditional"/>. In this way it may avoid blindly
-          overwriting the configuration of C1 if C1's configuration reached the
-          leader first.</para>
-        <para>With incremental reconfiguration, both changes will take effect as
-          they are simply applied by the leader one after the other to the
-          current configuration, whatever that is (assuming that the second
-          reconfig request reaches the leader after it sends a commit message
-          for the first reconfig request -- currently the leader will refuse to
-          propose a reconfiguration if another one is already pending). Since
-          both clients are guaranteed to make progress, this method guarantees
-          stronger liveness. In practice, multiple concurrent reconfigurations
-          are probably rare. Non-incremental reconfiguration is currently the
-          only way to dynamically change the Quorum System. Incremental
-          configuration is currently only allowed with the Majority Quorum
-          System.</para>
-        <para><emphasis role="bold">Changing an observer into a
-          follower:</emphasis> Clearly, changing a server that participates in
-          voting into an observer may fail if error (2) occurs, i.e., if fewer
-          than the minimal allowed number of participants would remain. However,
-          converting an observer into a participant may sometimes fail for a
-          more subtle reason: Suppose, for example, that the current
-          configuration is (A, B, C, D), where A is the leader, B and C are
-          followers and D is an observer. In addition, suppose that B has
-          crashed. If a reconfiguration is submitted where D is said to become a
-          follower, it will fail with error (3) since in this configuration, a
-          majority of voters in the new configuration (any 3 voters), must be
-          connected and up-to-date with the leader. An observer cannot
-          acknowledge the history prefix sent during reconfiguration, and
-          therefore it does not count towards these 3 required servers and the
-          reconfiguration will be aborted. In case this happens, a client can
-          achieve the same task by two reconfig commands: first invoke a
-          reconfig to remove D from the configuration and then invoke a second
-          command to add it back as a participant (follower). During the
-          intermediate state D is a non-voting follower and can ACK the state
-          transfer performed during the second reconfig comand.</para>
-      </section>
-    </section>
-  </section>
-  <section id="ch_reconfig_rebalancing">
-    <title>Rebalancing Client Connections</title>
-    <para>When a ZooKeeper cluster is started, if each client is given the same
-      connection string (list of servers), the client will randomly choose a
-      server in the list to connect to, which makes the expected number of
-      client connections per server the same for each of the servers. We
-      implemented a method that preserves this property when the set of servers
-      changes through reconfiguration. See Sections 4 and 5.1 in the <ulink
-      url="https://www.usenix.org/conference/usenixfederatedconferencesweek/dynamic-recon%EF%AC%81guration-primarybackup-clusters"
-      >paper</ulink>.</para>
-    <para>In order for the method to work, all clients must subscribe to
-      configuration changes (by setting a watch on /zookeeper/config either
-      directly or through the <command>getConfig</command> API command). When
-      the watch is triggered, the client should read the new configuration by
-      invoking <command>sync</command> and <command>getConfig</command> and if
-      the configuration is indeed new invoke the
-      <command>updateServerList</command> API command. To avoid mass client
-      migration at the same time, it is better to have each client sleep a
-      random short period of time before invoking
-      <command>updateServerList</command>.</para>
-    <para>A few examples can be found in:
-      <filename>StaticHostProviderTest.java</filename> and
-      <filename>TestReconfig.cc</filename></para>
-    <para>Example (this is not a recipe, but a simplified example just to
-      explain the general idea):</para>
-    <programlisting><![CDATA[
-public void process(WatchedEvent event) {
-    synchronized (this) {
-        if (event.getType() == EventType.None) {
-            connected = (event.getState() == KeeperState.SyncConnected);
-            notifyAll();
-        } else if (event.getPath()!=null &&  event.getPath().equals(ZooDefs.CONFIG_NODE)) {
-            // in prod code never block the event thread!
-            zk.sync(ZooDefs.CONFIG_NODE, this, null);
-            zk.getConfig(this, this, null);
-        }
-    }
-}
-public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) {
-    if (path!=null &&  path.equals(ZooDefs.CONFIG_NODE)) {
-        String config[] = ConfigUtils.getClientConfigStr(new String(data)).split(" ");   // similar to config -c
-        long version = Long.parseLong(config[0], 16);
-        if (this.configVersion == null){
-             this.configVersion = version;
-        } else if (version > this.configVersion) {
-            hostList = config[1];
-            try {
-                // the following command is not blocking but may cause the client to close the socket and
-                // migrate to a different server. In practice its better to wait a short period of time, chosen
-                // randomly, so that different clients migrate at different times
-                zk.updateServerList(hostList);
-            } catch (IOException e) {
-                System.err.println("Error updating server list");
-                e.printStackTrace();
-            }
-            this.configVersion = version;
-} } }]]></programlisting>
-  </section>
-</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/src/docs/src/documentation/content/xdocs/zookeeperStarted.xml
----------------------------------------------------------------------
diff --git a/src/docs/src/documentation/content/xdocs/zookeeperStarted.xml b/src/docs/src/documentation/content/xdocs/zookeeperStarted.xml
deleted file mode 100644
index e5cd777..0000000
--- a/src/docs/src/documentation/content/xdocs/zookeeperStarted.xml
+++ /dev/null
@@ -1,419 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 2002-2004 The Apache Software Foundation
-
-  Licensed 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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
-"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
-<article id="bk_GettStartedGuide">
-  <title>ZooKeeper Getting Started Guide</title>
-
-  <articleinfo>
-    <legalnotice>
-      <para>Licensed 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 <ulink
-      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
-
-      <para>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.</para>
-    </legalnotice>
-
-    <abstract>
-      <para>This guide contains detailed information about creating
-      distributed applications that use ZooKeeper. It discusses the basic
-      operations ZooKeeper supports, and how these can be used to build
-      higher-level abstractions. It contains solutions to common tasks, a
-      troubleshooting guide, and links to other information.</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="ch_GettingStarted">
-    <title>Getting Started: Coordinating Distributed Applications with
-      ZooKeeper</title>
-
-    <para>This document contains information to get you started quickly with
-    ZooKeeper. It is aimed primarily at developers hoping to try it out, and
-    contains simple installation instructions for a single ZooKeeper server, a
-    few commands to verify that it is running, and a simple programming
-    example. Finally, as a convenience, there are a few sections regarding
-    more complicated installations, for example running replicated
-    deployments, and optimizing the transaction log. However for the complete
-    instructions for commercial deployments, please refer to the <ulink
-    url="zookeeperAdmin.html">ZooKeeper
-    Administrator's Guide</ulink>.</para>
-
-    <section id="sc_Prerequisites">
-      <title>Pre-requisites</title>
-
-      <para>See <ulink url="zookeeperAdmin.html#sc_systemReq">
-          System Requirements</ulink> in the Admin guide.</para>
-    </section>
-
-    <section id="sc_Download">
-      <title>Download</title>
-
-      <para>To get a ZooKeeper distribution, download a recent
-        <ulink url="http://zookeeper.apache.org/releases.html">
-          stable</ulink> release from one of the Apache Download
-        Mirrors.</para>
-    </section>
-	
-    <section id="sc_InstallingSingleMode">
-      <title>Standalone Operation</title>
-
-      <para>Setting up a ZooKeeper server in standalone mode is
-      straightforward. The server is contained in a single JAR file,
-      so installation consists of creating a configuration.</para>
-
-      <para>Once you've downloaded a stable ZooKeeper release unpack
-      it and cd to the root</para>
-
-      <para>To start ZooKeeper you need a configuration file. Here is a sample,
-      create it in <emphasis role="bold">conf/zoo.cfg</emphasis>:</para>
-
-<programlisting>
-tickTime=2000
-dataDir=/var/lib/zookeeper
-clientPort=2181
-</programlisting>
-
-      <para>This file can be called anything, but for the sake of this
-      discussion call
-      it <emphasis role="bold">conf/zoo.cfg</emphasis>. Change the
-      value of <emphasis role="bold">dataDir</emphasis> to specify an
-      existing (empty to start with) directory.  Here are the meanings
-      for each of the fields:</para>
-
-      <variablelist>
-        <varlistentry>
-          <term><emphasis role="bold">tickTime</emphasis></term>
-
-          <listitem>
-            <para>the basic time unit in milliseconds used by ZooKeeper. It is
-            used to do heartbeats and the minimum session timeout will be
-            twice the tickTime.</para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-
-      <variablelist>
-        <varlistentry>
-          <term><emphasis role="bold">dataDir</emphasis></term>
-
-          <listitem>
-            <para>the location to store the in-memory database snapshots and,
-            unless specified otherwise, the transaction log of updates to the
-            database.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry>
-          <term><emphasis role="bold">clientPort</emphasis></term>
-
-          <listitem>
-            <para>the port to listen for client connections</para>
-          </listitem>
-        </varlistentry>
-      </variablelist>
-
-      <para>Now that you created the configuration file, you can start
-      ZooKeeper:</para>
-
-      <programlisting>bin/zkServer.sh start</programlisting>
-
-      <para>ZooKeeper logs messages using log4j -- more detail
-      available in the
-      <ulink url="zookeeperProgrammers.html#Logging">Logging</ulink>
-      section of the Programmer's Guide. You will see log messages
-      coming to the console (default) and/or a log file depending on
-      the log4j configuration.</para>
-
-      <para>The steps outlined here run ZooKeeper in standalone mode. There is
-      no replication, so if ZooKeeper process fails, the service will go down.
-      This is fine for most development situations, but to run ZooKeeper in
-      replicated mode, please see <ulink
-      url="#sc_RunningReplicatedZooKeeper">Running Replicated
-      ZooKeeper</ulink>.</para>
-    </section>
-	
-    <section id="sc_FileManagement">
-      <title>Managing ZooKeeper Storage</title>
-      <para>For long running production systems ZooKeeper storage must
-      be managed externally (dataDir and logs). See the section on
-      <ulink
-      url="zookeeperAdmin.html#sc_maintenance">maintenance</ulink> for
-      more details.</para>
-    </section>
-
-    <section id="sc_ConnectingToZooKeeper">
-      <title>Connecting to ZooKeeper</title>
-
-      <programlisting>$ bin/zkCli.sh -server 127.0.0.1:2181</programlisting>
-
-      <para>This lets you perform simple, file-like operations.</para>
-
-      <para>Once you have connected, you should see something like:
-        </para>
-      <programlisting>
-<![CDATA[
-Connecting to localhost:2181
-log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
-log4j:WARN Please initialize the log4j system properly.
-Welcome to ZooKeeper!
-JLine support is enabled
-[zkshell: 0]
-]]>        </programlisting>
-      <para>
-        From the shell, type <command>help</command> to get a listing of commands that can be executed from the client, as in:
-      </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 0] help
-ZooKeeper host:port cmd args
-        get path [watch]
-        ls path [watch]
-        set path data [version]
-        delquota [-n|-b] path
-        quit
-        printwatches on|off
-        create path data acl
-        stat path [watch]
-        listquota path
-        history
-        setAcl path acl
-        getAcl path
-        sync path
-        redo cmdno
-        addauth scheme auth
-        delete path [version]
-        deleteall path
-        setquota -n|-b val path
-
-]]>        </programlisting>
-      <para>From here, you can try a few simple commands to get a feel for this simple command line interface.  First, start by issuing the list command, as
-      in <command>ls</command>, yielding:
-      </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 8] ls /
-[zookeeper]
-]]>        </programlisting>
-      <para>Next, create a new znode by running <command>create /zk_test my_data</command>. This creates a new znode and associates the string "my_data" with the node.
-      You should see:</para>
-      <programlisting>
-<![CDATA[
-[zkshell: 9] create /zk_test my_data
-Created /zk_test
-]]>      </programlisting>
-      <para>  Issue another <command>ls /</command> command to see what the directory looks like:
-        </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 11] ls /
-[zookeeper, zk_test]
-
-]]>        </programlisting><para>
-      Notice that the zk_test directory has now been created.
-      </para>
-      <para>Next, verify that the data was associated with the znode by running the <command>get</command> command, as in:
-      </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 12] get /zk_test
-my_data
-cZxid = 5
-ctime = Fri Jun 05 13:57:06 PDT 2009
-mZxid = 5
-mtime = Fri Jun 05 13:57:06 PDT 2009
-pZxid = 5
-cversion = 0
-dataVersion = 0
-aclVersion = 0
-ephemeralOwner = 0
-dataLength = 7
-numChildren = 0
-]]>        </programlisting>
-      <para>We can change the data associated with zk_test by issuing the <command>set</command> command, as in:
-        </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 14] set /zk_test junk
-cZxid = 5
-ctime = Fri Jun 05 13:57:06 PDT 2009
-mZxid = 6
-mtime = Fri Jun 05 14:01:52 PDT 2009
-pZxid = 5
-cversion = 0
-dataVersion = 1
-aclVersion = 0
-ephemeralOwner = 0
-dataLength = 4
-numChildren = 0
-[zkshell: 15] get /zk_test
-junk
-cZxid = 5
-ctime = Fri Jun 05 13:57:06 PDT 2009
-mZxid = 6
-mtime = Fri Jun 05 14:01:52 PDT 2009
-pZxid = 5
-cversion = 0
-dataVersion = 1
-aclVersion = 0
-ephemeralOwner = 0
-dataLength = 4
-numChildren = 0
-]]>      </programlisting>
-      <para>
-       (Notice we did a <command>get</command> after setting the data and it did, indeed, change.</para>
-      <para>Finally, let's <command>delete</command> the node by issuing:
-      </para>
-      <programlisting>
-<![CDATA[
-[zkshell: 16] delete /zk_test
-[zkshell: 17] ls /
-[zookeeper]
-[zkshell: 18]
-]]></programlisting>
-      <para>That's it for now.  To explore more, continue with the rest of this document and see the <ulink url="zookeeperProgrammers.html">Programmer's Guide</ulink>. </para>
-    </section>
-
-    <section id="sc_ProgrammingToZooKeeper">
-      <title>Programming to ZooKeeper</title>
-
-      <para>ZooKeeper has a Java bindings and C bindings. They are
-      functionally equivalent. The C bindings exist in two variants: single
-      threaded and multi-threaded. These differ only in how the messaging loop
-      is done. For more information, see the <ulink
-      url="zookeeperProgrammers.html#ch_programStructureWithExample">Programming
-      Examples in the ZooKeeper Programmer's Guide</ulink> for
-      sample code using of the different APIs.</para>
-    </section>
-
-    <section id="sc_RunningReplicatedZooKeeper">
-      <title>Running Replicated ZooKeeper</title>
-
-      <para>Running ZooKeeper in standalone mode is convenient for evaluation,
-      some development, and testing. But in production, you should run
-      ZooKeeper in replicated mode. A replicated group of servers in the same
-      application is called a <emphasis>quorum</emphasis>, and in replicated
-      mode, all servers in the quorum have copies of the same configuration
-      file.</para>
-   <note>
-      <para>
-         For replicated mode, a minimum of three servers are required,
-         and it is strongly recommended that you have an odd number of
-         servers. If you only have two servers, then you are in a
-         situation where if one of them fails, there are not enough
-         machines to form a majority quorum. Two servers is inherently
-         <emphasis role="bold">less</emphasis>
-         stable than a single server, because there are two single
-         points of failure.
-      </para>
-   </note>
-   <para>
-      The required
-      <emphasis role="bold">conf/zoo.cfg</emphasis>
-      file for replicated mode is similar to the one used in standalone
-      mode, but with a few differences. Here is an example:
-   </para>
-
-<programlisting>
-tickTime=2000
-dataDir=/var/lib/zookeeper
-clientPort=2181
-initLimit=5
-syncLimit=2
-server.1=zoo1:2888:3888
-server.2=zoo2:2888:3888
-server.3=zoo3:2888:3888
-</programlisting>
-
-      <para>The new entry, <emphasis role="bold">initLimit</emphasis> is
-      timeouts ZooKeeper uses to limit the length of time the ZooKeeper
-      servers in quorum have to connect to a leader. The entry <emphasis
-      role="bold">syncLimit</emphasis> limits how far out of date a server can
-      be from a leader.</para>
-
-      <para>With both of these timeouts, you specify the unit of time using
-      <emphasis role="bold">tickTime</emphasis>. In this example, the timeout
-      for initLimit is 5 ticks at 2000 milleseconds a tick, or 10
-      seconds.</para>
-
-      <para>The entries of the form <emphasis>server.X</emphasis> list the
-      servers that make up the ZooKeeper service. When the server starts up,
-      it knows which server it is by looking for the file
-      <emphasis>myid</emphasis> in the data directory. That file has the 
-      contains the server number, in ASCII.</para>
-
-       <para>Finally, note the two port numbers after each server
-       name: " 2888" and "3888". Peers use the former port to connect
-       to other peers. Such a connection is necessary so that peers
-       can communicate, for example, to agree upon the order of
-       updates. More specifically, a ZooKeeper server uses this port
-       to connect followers to the leader. When a new leader arises, a
-       follower opens a TCP connection to the leader using this
-       port. Because the default leader election also uses TCP, we
-       currently require another port for leader election. This is the
-       second port in the server entry.
-       </para>
-
-      <note>
-        <para>If you want to test multiple servers on a single
-        machine, specify the servername
-        as <emphasis>localhost</emphasis> with unique quorum &amp;
-        leader election ports (i.e. 2888:3888, 2889:3889, 2890:3890 in
-        the example above) for each server.X in that server's config
-        file. Of course separate <emphasis>dataDir</emphasis>s and
-        distinct <emphasis>clientPort</emphasis>s are also necessary
-        (in the above replicated example, running on a
-        single <emphasis>localhost</emphasis>, you would still have
-        three config files).</para>
-        <para>Please be aware that setting up multiple servers on a single
-            machine will not create any redundancy. If something were to
-            happen which caused the machine to die, all of the zookeeper
-            servers would be offline. Full redundancy requires that each
-            server have its own machine. It must be a completely separate
-            physical server. Multiple virtual machines on the same physical
-            host are still vulnerable to the complete failure of that host.</para>
-      </note>
-    </section>
-
-    <section>
-      <title>Other Optimizations</title>
-
-      <para>There are a couple of other configuration parameters that can
-      greatly increase performance:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>To get low latencies on updates it is important to
-          have a dedicated transaction log directory. By default
-          transaction logs are put in the same directory as the data
-          snapshots and <emphasis>myid</emphasis> file. The dataLogDir
-          parameters indicates a different directory to use for the
-          transaction logs.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis>[tbd: what is the other config param?]</emphasis></para>
-        </listitem>
-      </itemizedlist>
-    </section>
-  </section>
-</article>


[04/13] zookeeper git commit: ZOOKEEPER-3022: MAVEN MIGRATION - Iteration 1 - docs, it

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
new file mode 100644
index 0000000..f71c4a8
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="zk_HierarchicalQuorums">
+  <title>Introduction to hierarchical quorums</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This document contains information about hierarchical quorums.</para>
+    </abstract>
+  </articleinfo>
+
+    <para>
+    This document gives an example of how to use hierarchical quorums. The basic idea is
+    very simple. First, we split servers into groups, and add a line for each group listing
+    the servers that form this group. Next we have to assign a weight to each server.  
+    </para>
+    
+    <para>
+    The following example shows how to configure a system with three groups of three servers
+    each, and we assign a weight of 1 to each server:
+    </para>
+    
+    <programlisting>
+    group.1=1:2:3
+    group.2=4:5:6
+    group.3=7:8:9
+   
+    weight.1=1
+    weight.2=1
+    weight.3=1
+    weight.4=1
+    weight.5=1
+    weight.6=1
+    weight.7=1
+    weight.8=1
+    weight.9=1
+ 	</programlisting>
+
+	<para>    
+    When running the system, we are able to form a quorum once we have a majority of votes from
+    a majority of non-zero-weight groups. Groups that have zero weight are discarded and not
+    considered when forming quorums. Looking at the example, we are able to form a quorum once
+    we have votes from at least two servers from each of two different groups.
+    </para> 
+ </article>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperInternals.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperInternals.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperInternals.xml
new file mode 100644
index 0000000..7815bc1
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperInternals.xml
@@ -0,0 +1,487 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="ar_ZooKeeperInternals">
+  <title>ZooKeeper Internals</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This article contains topics which discuss the inner workings of
+       ZooKeeper. So far, that's logging and atomic broadcast. </para>
+
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_Introduction">
+    <title>Introduction</title>
+
+    <para>This document contains information on the inner workings of ZooKeeper. 
+    So far, it discusses these topics:
+    </para>
+
+<itemizedlist>    
+<listitem><para><xref linkend="sc_atomicBroadcast"/></para></listitem>
+<listitem><para><xref linkend="sc_logging"/></para></listitem>
+</itemizedlist>
+
+</section>
+
+<section id="sc_atomicBroadcast">
+<title>Atomic Broadcast</title>
+
+<para>
+At the heart of ZooKeeper is an atomic messaging system that keeps all of the servers in sync.</para>
+
+<section id="sc_guaranteesPropertiesDefinitions"><title>Guarantees, Properties, and Definitions</title>
+<para>
+The specific guarantees provided by the messaging system used by ZooKeeper are the following:</para>
+
+<variablelist>
+
+<varlistentry><term><emphasis >Reliable delivery</emphasis></term>
+<listitem><para>If a message, m, is delivered 
+by one server, it will be eventually delivered by all servers.</para></listitem></varlistentry>
+
+<varlistentry><term><emphasis >Total order</emphasis></term>
+<listitem><para> If a message is 
+delivered before message b by one server, a will be delivered before b by all 
+servers. If a and b are delivered messages, either a will be delivered before b 
+or b will be delivered before a.</para></listitem></varlistentry>
+
+<varlistentry><term><emphasis >Causal order</emphasis> </term>
+
+<listitem><para>
+If a message b is sent after a message a has been delivered by the sender of b, 
+a must be ordered before b. If a sender sends c after sending b, c must be ordered after b.
+</para></listitem></varlistentry>
+
+</variablelist>
+
+
+<para>
+The ZooKeeper messaging system also needs to be efficient, reliable, and easy to 
+implement and maintain. We make heavy use of messaging, so we need the system to 
+be able to handle thousands of requests per second. Although we can require at 
+least k+1 correct servers to send new messages, we must be able to recover from 
+correlated failures such as power outages. When we implemented the system we had 
+little time and few engineering resources, so we needed a protocol that is 
+accessible to engineers and is easy to implement. We found that our protocol 
+satisfied all of these goals.
+
+</para>
+
+<para>
+Our protocol assumes that we can construct point-to-point FIFO channels between 
+the servers. While similar services usually assume message delivery that can 
+lose or reorder messages, our assumption of FIFO channels is very practical 
+given that we use TCP for communication. Specifically we rely on the following property of TCP:</para>
+
+<variablelist>
+
+<varlistentry>
+<term><emphasis >Ordered delivery</emphasis></term>
+<listitem><para>Data is delivered in the same order it is sent and a message m is 
+delivered only after all messages sent before m have been delivered. 
+(The corollary to this is that if message m is lost all messages after m will be lost.)</para></listitem></varlistentry>
+
+<varlistentry><term><emphasis >No message after close</emphasis></term>
+<listitem><para>Once a FIFO channel is closed, no messages will be received from it.</para></listitem></varlistentry>
+
+</variablelist>
+
+<para>
+FLP proved that consensus cannot be achieved in asynchronous distributed systems 
+if failures are possible. To ensure we achieve consensus in the presence of failures 
+we use timeouts. However, we rely on times for liveness not for correctness. So, 
+if timeouts stop working (clocks malfunction for example) the messaging system may 
+hang, but it will not violate its guarantees.</para>
+
+<para>When describing the ZooKeeper messaging protocol we will talk of packets, 
+proposals, and messages:</para>
+<variablelist>
+<varlistentry><term><emphasis >Packet</emphasis></term>
+<listitem><para>a sequence of bytes sent through a FIFO channel</para></listitem></varlistentry><varlistentry>
+
+<term><emphasis >Proposal</emphasis></term>
+<listitem><para>a unit of agreement. Proposals are agreed upon by exchanging packets 
+with a quorum of ZooKeeper servers. Most proposals contain messages, however the 
+NEW_LEADER proposal is an example of a proposal that does not correspond to a message.</para></listitem>
+</varlistentry><varlistentry>
+
+<term><emphasis >Message</emphasis></term>
+<listitem><para>a sequence of bytes to be atomically broadcast to all ZooKeeper 
+servers. A message put into a proposal and agreed upon before it is delivered.</para></listitem>
+</varlistentry>
+
+</variablelist>
+
+<para>
+As stated above, ZooKeeper guarantees a total order of messages, and it also 
+guarantees a total order of proposals. ZooKeeper exposes the total ordering using
+a ZooKeeper transaction id (<emphasis>zxid</emphasis>). All proposals will be stamped with a zxid when 
+it is proposed and exactly reflects the total ordering. Proposals are sent to all 
+ZooKeeper servers and committed when a quorum of them acknowledge the proposal. 
+If a proposal contains a message, the message will be delivered when the proposal 
+is committed. Acknowledgement means the server has recorded the proposal to persistent storage. 
+Our quorums have the requirement that any pair of quorum must have at least one server 
+in common. We ensure this by requiring that all quorums have size (<emphasis>n/2+1</emphasis>) where 
+n is the number of servers that make up a ZooKeeper service.
+</para>
+
+<para>
+The zxid has two parts: the epoch and a counter. In our implementation the zxid 
+is a 64-bit number. We use the high order 32-bits for the epoch and the low order 
+32-bits for the counter. Because it has two parts represent the zxid both as a 
+number and as a pair of integers, (<emphasis>epoch, count</emphasis>). The epoch number represents a 
+change in leadership. Each time a new leader comes into power it will have its 
+own epoch number. We have a simple algorithm to assign a unique zxid to a proposal: 
+the leader simply increments the zxid to obtain a unique zxid for each proposal. 
+<emphasis>Leadership activation will ensure that only one leader uses a given epoch, so our 
+simple algorithm guarantees that every proposal will have a unique id.</emphasis>
+</para>
+
+<para>
+ZooKeeper messaging consists of two phases:</para>
+
+<variablelist>
+<varlistentry><term><emphasis >Leader activation</emphasis></term>
+<listitem><para>In this phase a leader establishes the correct state of the system 
+and gets ready to start making proposals.</para></listitem>
+</varlistentry>
+
+<varlistentry><term><emphasis >Active messaging</emphasis></term>
+<listitem><para>In this phase a leader accepts messages to propose and coordinates message delivery.</para></listitem>
+</varlistentry>
+</variablelist>
+
+<para>
+ZooKeeper is a holistic protocol. We do not focus on individual proposals, rather 
+look at the stream of proposals as a whole. Our strict ordering allows us to do this 
+efficiently and greatly simplifies our protocol. Leadership activation embodies 
+this holistic concept. A leader becomes active only when a quorum of followers 
+(The leader counts as a follower as well. You can always vote for yourself ) has synced 
+up with the leader, they have the same state. This state consists of all of the 
+proposals that the leader believes have been committed and the proposal to follow 
+the leader, the NEW_LEADER proposal. (Hopefully you are thinking to 
+yourself, <emphasis>Does the set of proposals that the leader believes has been committed 
+included all the proposals that really have been committed?</emphasis> The answer is <emphasis>yes</emphasis>. 
+Below, we make clear why.)
+</para>
+
+</section>
+
+<section id="sc_leaderElection">
+
+<title>Leader Activation</title>
+<para>
+Leader activation includes leader election. We currently have two leader election 
+algorithms in ZooKeeper: LeaderElection and FastLeaderElection (AuthFastLeaderElection 
+is a variant of FastLeaderElection that uses UDP and allows servers to perform a simple
+form of authentication to avoid IP spoofing). ZooKeeper messaging doesn't care about the 
+exact method of electing a leader has long as the following holds:
+</para>
+
+<itemizedlist>
+
+<listitem><para>The leader has seen the highest zxid of all the followers.</para></listitem>
+<listitem><para>A quorum of servers have committed to following the leader.</para></listitem>
+
+</itemizedlist>
+
+<para>
+Of these two requirements only the first, the highest zxid amoung the followers 
+needs to hold for correct operation. The second requirement, a quorum of followers, 
+just needs to hold with high probability. We are going to recheck the second requirement, 
+so if a failure happens during or after the leader election and quorum is lost, 
+we will recover by abandoning leader activation and running another election.
+</para>
+
+<para>
+After leader election a single server will be designated as a leader and start 
+waiting for followers to connect. The rest of the servers will try to connect to 
+the leader. The leader will sync up with followers by sending any proposals they 
+are missing, or if a follower is missing too many proposals, it will send a full 
+snapshot of the state to the follower.
+</para>
+
+<para>
+There is a corner case in which a follower that has proposals, U, not seen 
+by a leader arrives. Proposals are seen in order, so the proposals of U will have a zxids 
+higher than zxids seen by the leader. The follower must have arrived after the 
+leader election, otherwise the follower would have been elected leader given that 
+it has seen a higher zxid. Since committed proposals must be seen by a quorum of 
+servers, and a quorum of servers that elected the leader did not see U, the proposals 
+of you have not been committed, so they can be discarded. When the follower connects 
+to the leader, the leader will tell the follower to discard U.
+</para>
+
+<para>
+A new leader establishes a zxid to start using for new proposals by getting the 
+epoch, e, of the highest zxid it has seen and setting the next zxid to use to be 
+(e+1, 0), fter the leader syncs with a follower, it will propose a NEW_LEADER 
+proposal. Once the NEW_LEADER proposal has been committed, the leader will activate 
+and start receiving and issuing proposals.
+</para>
+
+<para>
+It all sounds complicated but here are the basic rules of operation during leader 
+activation:
+</para>
+
+<itemizedlist>
+<listitem><para>A follower will ACK the NEW_LEADER proposal after it has synced with the leader.</para></listitem>
+<listitem><para>A follower will only ACK a NEW_LEADER proposal with a given zxid from a single server.</para></listitem>
+<listitem><para>A new leader will COMMIT the NEW_LEADER proposal when a quorum of followers have ACKed it.</para></listitem>
+<listitem><para>A follower will commit any state it received from the leader when the NEW_LEADER proposal is COMMIT.</para></listitem>
+<listitem><para>A new leader will not accept new proposals until the NEW_LEADER proposal has been COMMITED.</para></listitem>
+</itemizedlist>
+
+<para>
+If leader election terminates erroneously, we don't have a problem since the 
+NEW_LEADER proposal will not be committed since the leader will not have quorum. 
+When this happens, the leader and any remaining followers will timeout and go back 
+to leader election.
+</para>
+
+</section>
+
+<section id="sc_activeMessaging">
+<title>Active Messaging</title>
+<para>
+Leader Activation does all the heavy lifting. Once the leader is coronated he can 
+start blasting out proposals. As long as he remains the leader no other leader can 
+emerge since no other leader will be able to get a quorum of followers. If a new 
+leader does emerge, 
+it means that the leader has lost quorum, and the new leader will clean up any 
+mess left over during her leadership activation.
+</para>
+
+<para>ZooKeeper messaging operates similar to a classic two-phase commit.</para>
+
+<mediaobject id="fg_2phaseCommit" >
+  <imageobject>
+    <imagedata fileref="images/2pc.jpg"/>
+  </imageobject>
+</mediaobject>
+
+<para>
+All communication channels are FIFO, so everything is done in order. Specifically 
+the following operating constraints are observed:</para>
+
+<itemizedlist>
+
+<listitem><para>The leader sends proposals to all followers using 
+the same order. Moreover, this order follows the order in which requests have been 
+received. Because we use FIFO channels this means that followers also receive proposals in order.
+</para></listitem>
+
+<listitem><para>Followers process messages in the order they are received. This 
+means that messages will be ACKed in order and the leader will receive ACKs from 
+followers in order, due to the FIFO channels. It also means that if message $m$ 
+has been written to non-volatile storage, all messages that were proposed before 
+$m$ have been written to non-volatile storage.</para></listitem>
+
+<listitem><para>The leader will issue a COMMIT to all followers as soon as a 
+quorum of followers have ACKed a message. Since messages are ACKed in order, 
+COMMITs will be sent by the leader as received by the followers in order.</para></listitem>
+
+<listitem><para>COMMITs are processed in order. Followers deliver a proposals 
+message when that proposal is committed.</para></listitem>
+
+</itemizedlist>
+
+</section>
+
+<section id="sc_summary">
+<title>Summary</title>
+<para>So there you go. Why does it work? Specifically, why does a set of proposals 
+believed by a new leader always contain any proposal that has actually been committed? 
+First, all proposals have a unique zxid, so unlike other protocols, we never have 
+to worry about two different values being proposed for the same zxid; followers 
+(a leader is also a follower) see and record proposals in order; proposals are 
+committed in order; there is only one active leader at a time since followers only 
+follow a single leader at a time; a new leader has seen all committed proposals 
+from the previous epoch since it has seen the highest zxid from a quorum of servers; 
+any uncommited proposals from a previous epoch seen by a new leader will be committed 
+by that leader before it becomes active.</para></section>
+
+<section id="sc_comparisons"><title>Comparisons</title>
+<para>
+Isn't this just Multi-Paxos? No, Multi-Paxos requires some way of assuring that 
+there is only a single coordinator. We do not count on such assurances. Instead 
+we use the leader activation to recover from leadership change or old leaders 
+believing they are still active.
+</para>
+
+<para>
+Isn't this just Paxos? Your active messaging phase looks just like phase 2 of Paxos? 
+Actually, to us active messaging looks just like 2 phase commit without the need to 
+handle aborts. Active messaging is different from both in the sense that it has 
+cross proposal ordering requirements. If we do not maintain strict FIFO ordering of 
+all packets, it all falls apart. Also, our leader activation phase is different from 
+both of them. In particular, our use of epochs allows us to skip blocks of uncommitted
+proposals and to not worry about duplicate proposals for a given zxid.
+</para>
+
+</section>
+
+</section>
+
+<section id="sc_quorum">
+<title>Quorums</title>
+
+<para>
+Atomic broadcast and leader election use the notion of quorum to guarantee a consistent
+view of the system. By default, ZooKeeper uses majority quorums, which means that every
+voting that happens in one of these protocols requires a majority to vote on. One example is
+acknowledging a leader proposal: the leader can only commit once it receives an
+acknowledgement from a quorum of servers.
+</para>
+
+<para>
+If we extract the properties that we really need from our use of majorities, we have that we only
+need to guarantee that groups of processes used to validate an operation by voting (e.g., acknowledging
+a leader proposal) pairwise intersect in at least one server. Using majorities guarantees such a property.
+However, there are other ways of constructing quorums different from majorities. For example, we can assign
+weights to the votes of servers, and say that the votes of some servers are more important. To obtain a quorum,
+we get enough votes so that the sum of weights of all votes is larger than half of the total sum of all weights.    
+</para>
+
+<para>
+A different construction that uses weights and is useful in wide-area deployments (co-locations) is a hierarchical
+one. With this construction, we split the servers into disjoint groups and assign weights to processes. To form 
+a quorum, we have to get a hold of enough servers from a majority of groups G, such that for each group g in G,
+the sum of votes from g is larger than half of the sum of weights in g. Interestingly, this construction enables
+smaller quorums. If we have, for example, 9 servers, we split them into 3 groups, and assign a weight of 1 to each
+server, then we are able to form quorums of size 4. Note that two subsets of processes composed each of a majority
+of servers from each of a majority of groups necessarily have a non-empty intersection. It is reasonable to expect
+that a majority of co-locations will have a majority of servers available with high probability. 
+</para>  
+
+<para>
+With ZooKeeper, we provide a user with the ability of configuring servers to use majority quorums, weights, or a 
+hierarchy of groups.
+</para>
+</section>
+
+<section id="sc_logging">
+
+<title>Logging</title>
+<para>
+Zookeeper uses 
+<ulink url="http://www.slf4j.org/index.html">slf4j</ulink> as an abstraction layer for logging. 
+<ulink url="http://logging.apache.org/log4j">log4j</ulink> in version 1.2 is chosen as the final logging implementation for now.
+For better embedding support, it is planned in the future to leave the decision of choosing the final logging implementation to the end user.
+Therefore, always use the slf4j api to write log statements in the code, but configure log4j for how to log at runtime.
+Note that slf4j has no FATAL level, former messages at FATAL level have been moved to ERROR level. 
+For information on configuring log4j for
+ZooKeeper, see the <ulink url="zookeeperAdmin.html#sc_logging">Logging</ulink> section 
+of the <ulink url="zookeeperAdmin.html">ZooKeeper Administrator's Guide.</ulink>
+
+</para>
+
+<section id="sc_developerGuidelines"><title>Developer Guidelines</title>
+
+<para>Please follow the  
+<ulink url="http://www.slf4j.org/manual.html">slf4j manual</ulink> when creating log statements within code.
+Also read the
+<ulink url="http://www.slf4j.org/faq.html#logging_performance">FAQ on performance</ulink>
+, when creating log statements. Patch reviewers will look for the following:</para>
+<section id="sc_rightLevel"><title>Logging at the Right Level</title>
+<para>
+There are several levels of logging in slf4j. 
+It's important to pick the right one. In order of higher to lower severity:</para>
+<orderedlist>
+   <listitem><para>ERROR level designates error events that might still allow the application to continue running.</para></listitem>
+   <listitem><para>WARN level designates potentially harmful situations.</para></listitem>
+   <listitem><para>INFO level designates informational messages that highlight the progress of the application at coarse-grained level.</para></listitem>
+   <listitem><para>DEBUG Level designates fine-grained informational events that are most useful to debug an application.</para></listitem>
+   <listitem><para>TRACE Level designates finer-grained informational events than the DEBUG.</para></listitem>
+</orderedlist>
+
+<para>
+ZooKeeper is typically run in production such that log messages of INFO level 
+severity and higher (more severe) are output to the log.</para>
+
+
+</section>
+
+<section id="sc_slf4jIdioms"><title>Use of Standard slf4j Idioms</title>
+
+<para><emphasis>Static Message Logging</emphasis></para>
+<programlisting>
+LOG.debug("process completed successfully!");
+</programlisting>
+
+<para>
+However when creating parameterized messages are required, use formatting anchors.
+</para>
+
+<programlisting>
+LOG.debug("got {} messages in {} minutes",new Object[]{count,time});    
+</programlisting>
+
+
+<para><emphasis>Naming</emphasis></para>
+
+<para>
+Loggers should be named after the class in which they are used.
+</para>
+
+<programlisting>
+public class Foo {
+    private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
+    ....
+    public Foo() {
+       LOG.info("constructing Foo");
+</programlisting>
+
+<para><emphasis>Exception handling</emphasis></para>
+<programlisting>
+try {
+  // code
+} catch (XYZException e) {
+  // do this
+  LOG.error("Something bad happened", e);
+  // don't do this (generally)
+  // LOG.error(e);
+  // why? because "don't do" case hides the stack trace
+ 
+  // continue process here as you need... recover or (re)throw
+}
+</programlisting>
+</section>
+</section>
+
+</section>
+
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperJMX.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperJMX.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperJMX.xml
new file mode 100644
index 0000000..f0ea636
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperJMX.xml
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_zookeeperjmx">
+  <title>ZooKeeper JMX</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>ZooKeeper support for JMX</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_jmx">
+    <title>JMX</title>
+    <para>Apache ZooKeeper has extensive support for JMX, allowing you
+    to view and manage a ZooKeeper serving ensemble.</para>
+
+    <para>This document assumes that you have basic knowledge of
+    JMX. See <ulink
+    url="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">
+    Sun JMX Technology</ulink> page to get started with JMX.
+    </para>
+
+    <para>See the <ulink
+    url="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html">
+    JMX Management Guide</ulink> for details on setting up local and
+    remote management of VM instances. By default the included
+    <emphasis>zkServer.sh</emphasis> supports only local management -
+    review the linked document to enable support for remote management
+    (beyond the scope of this document).
+    </para>
+
+  </section>
+
+  <section id="ch_starting">
+    <title>Starting ZooKeeper with JMX enabled</title>
+
+    <para>The class
+      <emphasis>org.apache.zookeeper.server.quorum.QuorumPeerMain</emphasis>
+      will start a JMX manageable ZooKeeper server. This class
+      registers the proper MBeans during initalization to support JMX
+      monitoring and management of the
+      instance. See <emphasis>bin/zkServer.sh</emphasis> for one
+      example of starting ZooKeeper using QuorumPeerMain.</para>
+  </section>
+
+  <section id="ch_console">
+    <title>Run a JMX console</title>
+
+    <para>There are a number of JMX consoles available which can connect
+      to the running server. For this example we will use Sun's
+      <emphasis>jconsole</emphasis>.</para>
+
+    <para>The Java JDK ships with a simple JMX console
+      named <ulink url="http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html">jconsole</ulink>
+      which can be used to connect to ZooKeeper and inspect a running
+      server. Once you've started ZooKeeper using QuorumPeerMain
+      start <emphasis>jconsole</emphasis>, which typically resides in
+      <emphasis>JDK_HOME/bin/jconsole</emphasis></para>
+
+    <para>When the "new connection" window is displayed either connect
+      to local process (if jconsole started on same host as Server) or
+      use the remote process connection.</para>
+
+    <para>By default the "overview" tab for the VM is displayed (this
+      is a great way to get insight into the VM btw). Select
+      the "MBeans" tab.</para>
+
+    <para>You should now see <emphasis>org.apache.ZooKeeperService</emphasis>
+      on the left hand side. Expand this item and depending on how you've
+      started the server you will be able to monitor and manage various
+      service related features.</para>
+
+    <para>Also note that ZooKeeper will register log4j MBeans as
+    well. In the same section along the left hand side you will see
+    "log4j". Expand that to manage log4j through JMX. Of particular
+    interest is the ability to dynamically change the logging levels
+    used by editing the appender and root thresholds. Log4j MBean
+    registration can be disabled by passing
+    <emphasis>-Dzookeeper.jmx.log4j.disable=true</emphasis> to the JVM
+    when starting ZooKeeper.
+    </para>
+
+  </section>
+
+  <section id="ch_reference">
+    <title>ZooKeeper MBean Reference</title>
+
+    <para>This table details JMX for a server participating in a
+    replicated ZooKeeper ensemble (ie not standalone). This is the
+    typical case for a production environment.</para>
+
+    <table>
+      <title>MBeans, their names and description</title>
+
+      <tgroup cols='4'>
+        <thead>
+          <row>
+            <entry>MBean</entry>
+            <entry>MBean Object Name</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>Quorum</entry>
+            <entry>ReplicatedServer_id&lt;#&gt;</entry>
+            <entry>Represents the Quorum, or Ensemble - parent of all
+            cluster members. Note that the object name includes the
+            "myid" of the server (name suffix) that your JMX agent has
+            connected to.</entry>
+          </row>
+          <row>
+            <entry>LocalPeer|RemotePeer</entry>
+            <entry>replica.&lt;#&gt;</entry>
+            <entry>Represents a local or remote peer (ie server
+            participating in the ensemble). Note that the object name
+            includes the "myid" of the server (name suffix).</entry>
+          </row>
+          <row>
+            <entry>LeaderElection</entry>
+            <entry>LeaderElection</entry>
+            <entry>Represents a ZooKeeper cluster leader election which is
+            in progress. Provides information about the election, such as
+            when it started.</entry>
+          </row>
+          <row>
+            <entry>Leader</entry>
+            <entry>Leader</entry>
+            <entry>Indicates that the parent replica is the leader and
+            provides attributes/operations for that server. Note that
+            Leader is a subclass of ZooKeeperServer, so it provides
+            all of the information normally associated with a
+            ZooKeeperServer node.</entry>
+          </row>
+          <row>
+            <entry>Follower</entry>
+            <entry>Follower</entry>
+            <entry>Indicates that the parent replica is a follower and
+            provides attributes/operations for that server. Note that
+            Follower is a subclass of ZooKeeperServer, so it provides
+            all of the information normally associated with a
+            ZooKeeperServer node.</entry>
+          </row>
+          <row>
+            <entry>DataTree</entry>
+            <entry>InMemoryDataTree</entry>
+            <entry>Statistics on the in memory znode database, also
+            operations to access finer (and more computationally
+            intensive) statistics on the data (such as ephemeral
+            count). InMemoryDataTrees are children of ZooKeeperServer
+            nodes.</entry>
+          </row>
+          <row>
+            <entry>ServerCnxn</entry>
+            <entry>&lt;session_id&gt;</entry>
+            <entry>Statistics on each client connection, also
+            operations on those connections (such as
+            termination). Note the object name is the session id of
+            the connection in hex form.</entry>
+          </row>
+    </tbody></tgroup></table>
+
+    <para>This table details JMX for a standalone server. Typically
+    standalone is only used in development situations.</para>
+
+    <table>
+      <title>MBeans, their names and description</title>
+
+      <tgroup cols='4'>
+        <thead>
+          <row>
+            <entry>MBean</entry>
+            <entry>MBean Object Name</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>ZooKeeperServer</entry>
+            <entry>StandaloneServer_port&lt;#&gt;</entry>
+            <entry>Statistics on the running server, also operations
+            to reset these attributes. Note that the object name
+            includes the client port of the server (name
+            suffix).</entry>
+          </row>
+          <row>
+            <entry>DataTree</entry>
+            <entry>InMemoryDataTree</entry>
+            <entry>Statistics on the in memory znode database, also
+            operations to access finer (and more computationally
+            intensive) statistics on the data (such as ephemeral
+            count).</entry>
+          </row>
+          <row>
+            <entry>ServerCnxn</entry>
+            <entry>&lt;session_id&gt;</entry>
+            <entry>Statistics on each client connection, also
+            operations on those connections (such as
+            termination). Note the object name is the session id of
+            the connection in hex form.</entry>
+          </row>
+    </tbody></tgroup></table>
+
+  </section>
+
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperObservers.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperObservers.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperObservers.xml
new file mode 100644
index 0000000..fab6769
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperObservers.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_GettStartedGuide">
+  <title>ZooKeeper Observers</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+      
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This guide contains information about using non-voting servers, or
+      observers in your ZooKeeper ensembles.</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_Introduction">
+    <title>Observers: Scaling ZooKeeper Without Hurting Write Performance
+      </title>
+    <para>
+      Although ZooKeeper performs very well by having clients connect directly
+      to voting members of the ensemble, this architecture makes it hard to
+      scale out to huge numbers of clients. The problem is that as we add more
+      voting members, the write performance drops. This is due to the fact that
+      a write operation requires the agreement of (in general) at least half the
+      nodes in an ensemble and therefore the cost of a vote can increase
+      significantly as more voters are added.
+    </para>
+    <para>
+      We have introduced a new type of ZooKeeper node called
+      an <emphasis>Observer</emphasis> which helps address this problem and
+      further improves ZooKeeper's scalability. Observers are non-voting members
+      of an ensemble which only hear the results of votes, not the agreement
+      protocol that leads up to them. Other than this simple distinction,
+      Observers function exactly the same as Followers - clients may connect to
+      them and send read and write requests to them. Observers forward these
+      requests to the Leader like Followers do, but they then simply wait to
+      hear the result of the vote. Because of this, we can increase the number
+      of Observers as much as we like without harming the performance of votes.
+    </para>
+    <para>
+      Observers have other advantages. Because they do not vote, they are not a
+      critical part of the ZooKeeper ensemble. Therefore they can fail, or be
+      disconnected from the cluster, without harming the availability of the
+      ZooKeeper service. The benefit to the user is that Observers may connect
+      over less reliable network links than Followers. In fact, Observers may be
+      used to talk to a ZooKeeper server from another data center. Clients of
+      the Observer will see fast reads, as all reads are served locally, and
+      writes result in minimal network traffic as the number of messages
+      required in the absence of the vote protocol is smaller.
+    </para>
+  </section>
+  <section id="sc_UsingObservers">
+    <title>How to use Observers</title>
+    <para>Setting up a ZooKeeper ensemble that uses Observers is very simple,
+    and requires just two changes to your config files. Firstly, in the config
+    file of every node that is to be an Observer, you must place this line:
+    </para>
+    <programlisting>
+      peerType=observer
+    </programlisting>
+    
+    <para>
+      This line tells ZooKeeper that the server is to be an Observer. Secondly,
+      in every server config file, you must add :observer to the server
+      definition line of each Observer. For example:
+    </para>
+    
+    <programlisting>
+      server.1:localhost:2181:3181:observer
+    </programlisting>
+    
+    <para>
+      This tells every other server that server.1 is an Observer, and that they
+      should not expect it to vote. This is all the configuration you need to do
+      to add an Observer to your ZooKeeper cluster. Now you can connect to it as
+      though it were an ordinary Follower. Try it out, by running:</para>
+    <programlisting>
+      $ bin/zkCli.sh -server localhost:2181
+    </programlisting>
+    <para>
+      where localhost:2181 is the hostname and port number of the Observer as
+      specified in every config file. You should see a command line prompt
+      through which you can issue commands like <emphasis>ls</emphasis> to query
+      the ZooKeeper service.
+    </para>
+  </section>
+  
+  <section id="ch_UseCases">
+    <title>Example use cases</title>
+    <para>
+      Two example use cases for Observers are listed below. In fact, wherever
+      you wish to scale the number of clients of your ZooKeeper ensemble, or
+      where you wish to insulate the critical part of an ensemble from the load
+      of dealing with client requests, Observers are a good architectural
+      choice.
+    </para>
+    <itemizedlist>
+      <listitem>
+	<para> As a datacenter bridge: Forming a ZK ensemble between two
+	datacenters is a problematic endeavour as the high variance in latency
+	between the datacenters could lead to false positive failure detection
+	and partitioning. However if the ensemble runs entirely in one
+	datacenter, and the second datacenter runs only Observers, partitions
+	aren't problematic as the ensemble remains connected. Clients of the
+	Observers may still see and issue proposals.</para>
+      </listitem>
+      <listitem>
+	<para>As a link to a message bus: Some companies have expressed an
+	interest in using ZK as a component of a persistent reliable message
+	bus. Observers would give a natural integration point for this work: a
+	plug-in mechanism could be used to attach the stream of proposals an
+	Observer sees to a publish-subscribe system, again without loading the
+	core ensemble.
+	</para>
+      </listitem>
+    </itemizedlist>
+  </section>
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
new file mode 100644
index 0000000..a2445b1
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperOtherInfo.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_OtherInfo">
+  <title>ZooKeeper</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para> currently empty </para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_placeholder">
+    <title>Other Info</title>
+    <para> currently empty </para>
+  </section>
+</article>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/4607a3e1/zookeeper-docs/src/documentation/content/xdocs/zookeeperOver.xml
----------------------------------------------------------------------
diff --git a/zookeeper-docs/src/documentation/content/xdocs/zookeeperOver.xml b/zookeeper-docs/src/documentation/content/xdocs/zookeeperOver.xml
new file mode 100644
index 0000000..f972657
--- /dev/null
+++ b/zookeeper-docs/src/documentation/content/xdocs/zookeeperOver.xml
@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
+"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
+<article id="bk_Overview">
+  <title>ZooKeeper</title>
+
+  <articleinfo>
+    <legalnotice>
+      <para>Licensed 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 <ulink
+      url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para>
+
+      <para>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.</para>
+    </legalnotice>
+
+    <abstract>
+      <para>This document contains overview information about ZooKeeper. It
+      discusses design goals, key concepts, implementation, and
+      performance.</para>
+    </abstract>
+  </articleinfo>
+
+  <section id="ch_DesignOverview">
+    <title>ZooKeeper: A Distributed Coordination Service for Distributed
+    Applications</title>
+
+    <para>ZooKeeper is a distributed, open-source coordination service for
+    distributed applications. It exposes a simple set of primitives that
+    distributed applications can build upon to implement higher level services
+    for synchronization, configuration maintenance, and groups and naming. It
+    is designed to be easy to program to, and uses a data model styled after
+    the familiar directory tree structure of file systems. It runs in Java and
+    has bindings for both Java and C.</para>
+
+    <para>Coordination services are notoriously hard to get right. They are
+    especially prone to errors such as race conditions and deadlock. The
+    motivation behind ZooKeeper is to relieve distributed applications the
+    responsibility of implementing coordination services from scratch.</para>
+
+    <section id="sc_designGoals">
+      <title>Design Goals</title>
+
+      <para><emphasis role="bold">ZooKeeper is simple.</emphasis> ZooKeeper
+      allows distributed processes to coordinate with each other through a
+      shared hierarchal namespace which is organized similarly to a standard
+      file system. The name space consists of data registers - called znodes,
+      in ZooKeeper parlance - and these are similar to files and directories.
+      Unlike a typical file system, which is designed for storage, ZooKeeper
+      data is kept in-memory, which means ZooKeeper can achieve high
+      throughput and low latency numbers.</para>
+
+      <para>The ZooKeeper implementation puts a premium on high performance,
+      highly available, strictly ordered access. The performance aspects of
+      ZooKeeper means it can be used in large, distributed systems. The
+      reliability aspects keep it from being a single point of failure. The
+      strict ordering means that sophisticated synchronization primitives can
+      be implemented at the client.</para>
+
+      <para><emphasis role="bold">ZooKeeper is replicated.</emphasis> Like the
+      distributed processes it coordinates, ZooKeeper itself is intended to be
+      replicated over a sets of hosts called an ensemble.</para>
+
+      <figure>
+        <title>ZooKeeper Service</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="images/zkservice.jpg" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>The servers that make up the ZooKeeper service must all know about
+      each other. They maintain an in-memory image of state, along with a
+      transaction logs and snapshots in a persistent store. As long as a
+      majority of the servers are available, the ZooKeeper service will be
+      available.</para>
+
+      <para>Clients connect to a single ZooKeeper server. The client maintains
+      a TCP connection through which it sends requests, gets responses, gets
+      watch events, and sends heart beats. If the TCP connection to the server
+      breaks, the client will connect to a different server.</para>
+
+      <para><emphasis role="bold">ZooKeeper is ordered.</emphasis> ZooKeeper
+      stamps each update with a number that reflects the order of all
+      ZooKeeper transactions. Subsequent operations can use the order to
+      implement higher-level abstractions, such as synchronization
+      primitives.</para>
+
+      <para><emphasis role="bold">ZooKeeper is fast.</emphasis> It is
+      especially fast in "read-dominant" workloads. ZooKeeper applications run
+      on thousands of machines, and it performs best where reads are more
+      common than writes, at ratios of around 10:1.</para>
+    </section>
+
+    <section id="sc_dataModelNameSpace">
+      <title>Data model and the hierarchical namespace</title>
+
+      <para>The name space provided by ZooKeeper is much like that of a
+      standard file system. A name is a sequence of path elements separated by
+      a slash (/). Every node in ZooKeeper's name space is identified by a
+      path.</para>
+
+      <figure>
+        <title>ZooKeeper's Hierarchical Namespace</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="images/zknamespace.jpg" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+    </section>
+
+    <section>
+      <title>Nodes and ephemeral nodes</title>
+
+      <para>Unlike standard file systems, each node in a ZooKeeper
+      namespace can have data associated with it as well as children. It is
+      like having a file-system that allows a file to also be a directory.
+      (ZooKeeper was designed to store coordination data: status information,
+      configuration, location information, etc., so the data stored at each
+      node is usually small, in the byte to kilobyte range.) We use the term
+      <emphasis>znode</emphasis> to make it clear that we are talking about
+      ZooKeeper data nodes.</para>
+
+      <para>Znodes maintain a stat structure that includes version numbers for
+      data changes, ACL changes, and timestamps, to allow cache validations
+      and coordinated updates. Each time a znode's data changes, the version
+      number increases. For instance, whenever a client retrieves data it also
+      receives the version of the data.</para>
+
+      <para>The data stored at each znode in a namespace is read and written
+      atomically. Reads get all the data bytes associated with a znode and a
+      write replaces all the data. Each node has an Access Control List (ACL)
+      that restricts who can do what.</para>
+
+      <para>ZooKeeper also has the notion of ephemeral nodes. These znodes
+      exists as long as the session that created the znode is active. When the
+      session ends the znode is deleted. Ephemeral nodes are useful when you
+      want to implement <emphasis>[tbd]</emphasis>.</para>
+    </section>
+
+    <section>
+      <title>Conditional updates and watches</title>
+
+      <para>ZooKeeper supports the concept of <emphasis>watches</emphasis>.
+      Clients can set a watch on a znode. A watch will be triggered and
+      removed when the znode changes. When a watch is triggered, the client
+      receives a packet saying that the znode has changed. If the
+      connection between the client and one of the Zoo Keeper servers is
+      broken, the client will receive a local notification. These can be used
+      to <emphasis>[tbd]</emphasis>.</para>
+    </section>
+
+    <section>
+      <title>Guarantees</title>
+
+      <para>ZooKeeper is very fast and very simple. Since its goal, though, is
+      to be a basis for the construction of more complicated services, such as
+      synchronization, it provides a set of guarantees. These are:</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>Sequential Consistency - Updates from a client will be applied
+          in the order that they were sent.</para>
+        </listitem>
+
+        <listitem>
+          <para>Atomicity - Updates either succeed or fail. No partial
+          results.</para>
+        </listitem>
+
+        <listitem>
+          <para>Single System Image - A client will see the same view of the
+          service regardless of the server that it connects to.</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>Reliability - Once an update has been applied, it will persist
+          from that time forward until a client overwrites the update.</para>
+        </listitem>
+      </itemizedlist>
+
+      <itemizedlist>
+        <listitem>
+          <para>Timeliness - The clients view of the system is guaranteed to
+          be up-to-date within a certain time bound.</para>
+        </listitem>
+      </itemizedlist>
+
+      <para>For more information on these, and how they can be used, see
+      <emphasis>[tbd]</emphasis></para>
+    </section>
+
+    <section>
+      <title>Simple API</title>
+
+      <para>One of the design goals of ZooKeeper is provide a very simple
+      programming interface. As a result, it supports only these
+      operations:</para>
+
+      <variablelist>
+        <varlistentry>
+          <term>create</term>
+
+          <listitem>
+            <para>creates a node at a location in the tree</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>delete</term>
+
+          <listitem>
+            <para>deletes a node</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>exists</term>
+
+          <listitem>
+            <para>tests if a node exists at a location</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>get data</term>
+
+          <listitem>
+            <para>reads the data from a node</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>set data</term>
+
+          <listitem>
+            <para>writes data to a node</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>get children</term>
+
+          <listitem>
+            <para>retrieves a list of children of a node</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry>
+          <term>sync</term>
+
+          <listitem>
+            <para>waits for data to be propagated</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+
+      <para>For a more in-depth discussion on these, and how they can be used
+      to implement higher level operations, please refer to
+      <emphasis>[tbd]</emphasis></para>
+    </section>
+
+    <section>
+      <title>Implementation</title>
+
+      <para><xref linkend="fg_zkComponents" /> shows the high-level components
+      of the ZooKeeper service. With the exception of the request processor,
+     each of
+      the servers that make up the ZooKeeper service replicates its own copy
+      of each of the components.</para>
+
+      <figure id="fg_zkComponents">
+        <title>ZooKeeper Components</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="images/zkcomponents.jpg" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>The replicated database is an in-memory database containing the
+      entire data tree. Updates are logged to disk for recoverability, and
+      writes are serialized to disk before they are applied to the in-memory
+      database.</para>
+
+      <para>Every ZooKeeper server services clients. Clients connect to
+      exactly one server to submit irequests. Read requests are serviced from
+      the local replica of each server database. Requests that change the
+      state of the service, write requests, are processed by an agreement
+      protocol.</para>
+
+      <para>As part of the agreement protocol all write requests from clients
+      are forwarded to a single server, called the
+      <emphasis>leader</emphasis>. The rest of the ZooKeeper servers, called
+      <emphasis>followers</emphasis>, receive message proposals from the
+      leader and agree upon message delivery. The messaging layer takes care
+      of replacing leaders on failures and syncing followers with
+      leaders.</para>
+
+      <para>ZooKeeper uses a custom atomic messaging protocol. Since the
+      messaging layer is atomic, ZooKeeper can guarantee that the local
+      replicas never diverge. When the leader receives a write request, it
+      calculates what the state of the system is when the write is to be
+      applied and transforms this into a transaction that captures this new
+      state.</para>
+    </section>
+
+    <section>
+      <title>Uses</title>
+
+      <para>The programming interface to ZooKeeper is deliberately simple.
+      With it, however, you can implement higher order operations, such as
+      synchronizations primitives, group membership, ownership, etc. Some
+      distributed applications have used it to: <emphasis>[tbd: add uses from
+      white paper and video presentation.]</emphasis> For more information, see
+      <emphasis>[tbd]</emphasis></para>
+    </section>
+
+    <section>
+      <title>Performance</title>
+
+      <para>ZooKeeper is designed to be highly performant. But is it? The
+      results of the ZooKeeper's development team at Yahoo! Research indicate
+      that it is. (See <xref linkend="fg_zkPerfRW" />.) It is especially high
+      performance in applications where reads outnumber writes, since writes
+      involve synchronizing the state of all servers. (Reads outnumbering
+      writes is typically the case for a coordination service.)</para>
+
+      <figure id="fg_zkPerfRW">
+        <title>ZooKeeper Throughput as the Read-Write Ratio Varies</title>
+
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="images/zkperfRW-3.2.jpg" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+      <para>The figure <xref linkend="fg_zkPerfRW"/> is a throughput
+      graph of ZooKeeper release 3.2 running on servers with dual 2Ghz
+      Xeon and two SATA 15K RPM drives.  One drive was used as a
+      dedicated ZooKeeper log device. The snapshots were written to
+      the OS drive. Write requests were 1K writes and the reads were
+      1K reads.  "Servers" indicate the size of the ZooKeeper
+      ensemble, the number of servers that make up the
+      service. Approximately 30 other servers were used to simulate
+      the clients. The ZooKeeper ensemble was configured such that
+      leaders do not allow connections from clients.</para>
+
+      <note><para>In version 3.2 r/w performance improved by ~2x
+      compared to the <ulink
+      url="http://zookeeper.apache.org/docs/r3.1.1/zookeeperOver.html#Performance">previous
+      3.1 release</ulink>.</para></note>
+
+      <para>Benchmarks also indicate that it is reliable, too. <xref
+      linkend="fg_zkPerfReliability" /> shows how a deployment responds to
+      various failures. The events marked in the figure are the
+      following:</para>
+
+      <orderedlist>
+        <listitem>
+          <para>Failure and recovery of a follower</para>
+        </listitem>
+
+        <listitem>
+          <para>Failure and recovery of a different follower</para>
+        </listitem>
+
+        <listitem>
+          <para>Failure of the leader</para>
+        </listitem>
+
+        <listitem>
+          <para>Failure and recovery of two followers</para>
+        </listitem>
+
+        <listitem>
+          <para>Failure of another leader</para>
+        </listitem>
+      </orderedlist>
+    </section>
+
+    <section>
+      <title>Reliability</title>
+
+      <para>To show the behavior of the system over time as
+        failures are injected we ran a ZooKeeper service made up of
+        7 machines. We ran the same saturation benchmark as before,
+        but this time we kept the write percentage at a constant
+        30%, which is a conservative ratio of our expected
+        workloads.
+      </para>
+      <figure id="fg_zkPerfReliability">
+        <title>Reliability in the Presence of Errors</title>
+        <mediaobject>
+          <imageobject>
+            <imagedata fileref="images/zkperfreliability.jpg" />
+          </imageobject>
+        </mediaobject>
+      </figure>
+
+      <para>The are a few important observations from this graph. First, if
+      followers fail and recover quickly, then ZooKeeper is able to sustain a
+      high throughput despite the failure. But maybe more importantly, the
+      leader election algorithm allows for the system to recover fast enough
+      to prevent throughput from dropping substantially. In our observations,
+      ZooKeeper takes less than 200ms to elect a new leader. Third, as
+      followers recover, ZooKeeper is able to raise throughput again once they
+      start processing requests.</para>
+    </section>
+
+    <section>
+      <title>The ZooKeeper Project</title>
+
+      <para>ZooKeeper has been
+          <ulink url="https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy">
+          successfully used
+        </ulink>
+        in many industrial applications.  It is used at Yahoo! as the
+        coordination and failure recovery service for Yahoo! Message
+        Broker, which is a highly scalable publish-subscribe system
+        managing thousands of topics for replication and data
+        delivery.  It is used by the Fetching Service for Yahoo!
+        crawler, where it also manages failure recovery. A number of
+        Yahoo! advertising systems also use ZooKeeper to implement
+        reliable services.
+      </para>
+
+      <para>All users and developers are encouraged to join the
+        community and contribute their expertise. See the
+        <ulink url="http://zookeeper.apache.org/">
+          Zookeeper Project on Apache
+        </ulink>
+        for more information.
+      </para>
+    </section>
+  </section>
+</article>