http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/api/serialized-form.html ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/api/serialized-form.html b/doc/r3.1.2/api/serialized-form.html new file mode 100644 index 0000000..7e84c75 --- /dev/null +++ b/doc/r3.1.2/api/serialized-form.html @@ -0,0 +1,397 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--NewPage--> +<HTML> +<HEAD> +<!-- Generated by javadoc (build 1.6.0_16) on Tue Dec 08 13:10:49 PST 2009 --> +<TITLE> +Serialized Form (ZooKeeper 3.1.2 API) +</TITLE> + +<META NAME="date" CONTENT="2009-12-08"> + +<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> + +<SCRIPT type="text/javascript"> +function windowTitle() +{ + if (location.href.indexOf('is-external=true') == -1) { + parent.document.title="Serialized Form (ZooKeeper 3.1.2 API)"; + } +} +</SCRIPT> +<NOSCRIPT> +</NOSCRIPT> + +</HEAD> + +<BODY BGCOLOR="white" onload="windowTitle();"> +<HR> + + +<!-- ========= START OF TOP NAVBAR ======= --> +<A NAME="navbar_top"><!-- --></A> +<A HREF="#skip-navbar_top" title="Skip navigation links"></A> +<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> +<TR> +<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> +<A NAME="navbar_top_firstrow"><!-- --></A> +<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> + <TR ALIGN="center" VALIGN="top"> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> + </TR> +</TABLE> +</TD> +<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> +</EM> +</TD> +</TR> + +<TR> +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> + PREV + NEXT</FONT></TD> +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> + <A HREF="index.html?serialized-form.html" target="_top"><B>FRAMES</B></A> + <A HREF="serialized-form.html" target="_top"><B>NO FRAMES</B></A> + <SCRIPT type="text/javascript"> + <!-- + if(window==top) { + document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); + } + //--> +</SCRIPT> +<NOSCRIPT> + <A HREF="allclasses-noframe.html"><B>All Classes</B></A> +</NOSCRIPT> + + +</FONT></TD> +</TR> +</TABLE> +<A NAME="skip-navbar_top"></A> +<!-- ========= END OF TOP NAVBAR ========= --> + +<HR> +<CENTER> +<H1> +Serialized Form</H1> +</CENTER> +<HR SIZE="4" NOSHADE> + +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="center"><FONT SIZE="+2"> +<B>Package</B> <B>org.apache.zookeeper</B></FONT></TH> +</TR> +</TABLE> + +<P> +<A NAME="org.apache.zookeeper.KeeperException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> +<A NAME="serializedForm"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> +<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> +<B>Serialized Fields</B></FONT></TH> +</TR> +</TABLE> + +<H3> +code</H3> +<PRE> +<A HREF="org/apache/zookeeper/KeeperException.Code.html" title="enum in org.apache.zookeeper">KeeperException.Code</A> <B>code</B></PRE> +<DL> +<DL> +</DL> +</DL> +<HR> +<H3> +path</H3> +<PRE> +<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>path</B></PRE> +<DL> +<DL> +</DL> +</DL> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.APIErrorException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.APIErrorException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.APIErrorException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.AuthFailedException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.AuthFailedException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.AuthFailedException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.BadArgumentsException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.BadArgumentsException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.BadArgumentsException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.BadVersionException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.BadVersionException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.BadVersionException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.ConnectionLossException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.ConnectionLossException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.ConnectionLossException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.DataInconsistencyException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.DataInconsistencyException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.DataInconsistencyException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.InvalidACLException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.InvalidACLException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.InvalidACLException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.InvalidCallbackException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.InvalidCallbackException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.InvalidCallbackException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.MarshallingErrorException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.MarshallingErrorException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.MarshallingErrorException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.NoAuthException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.NoAuthException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.NoAuthException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.NoChildrenForEphemeralsException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.NoChildrenForEphemeralsException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.NoChildrenForEphemeralsException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.NodeExistsException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.NodeExistsException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.NodeExistsException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.NoNodeException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.NoNodeException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.NoNodeException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.NotEmptyException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.NotEmptyException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.NotEmptyException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.OperationTimeoutException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.OperationTimeoutException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.OperationTimeoutException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.RuntimeInconsistencyException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.RuntimeInconsistencyException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.RuntimeInconsistencyException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.SessionExpiredException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.SessionExpiredException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.SessionExpiredException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.SystemErrorException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.SystemErrorException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.SystemErrorException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<A NAME="org.apache.zookeeper.KeeperException.UnimplementedException"><!-- --></A> +<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> +<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> +<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> +<B>Class <A HREF="org/apache/zookeeper/KeeperException.UnimplementedException.html" title="class in org.apache.zookeeper">org.apache.zookeeper.KeeperException.UnimplementedException</A> extends <A HREF="org/apache/zookeeper/KeeperException.html" title="class in org.apache.zookeeper">KeeperException</A> implements Serializable</B></FONT></TH> +</TR> +</TABLE> + +<P> + +<P> +<HR> + + +<!-- ======= START OF BOTTOM NAVBAR ====== --> +<A NAME="navbar_bottom"><!-- --></A> +<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> +<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> +<TR> +<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> +<A NAME="navbar_bottom_firstrow"><!-- --></A> +<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> + <TR ALIGN="center" VALIGN="top"> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> + <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> + </TR> +</TABLE> +</TD> +<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> +</EM> +</TD> +</TR> + +<TR> +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> + PREV + NEXT</FONT></TD> +<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> + <A HREF="index.html?serialized-form.html" target="_top"><B>FRAMES</B></A> + <A HREF="serialized-form.html" target="_top"><B>NO FRAMES</B></A> + <SCRIPT type="text/javascript"> + <!-- + if(window==top) { + document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); + } + //--> +</SCRIPT> +<NOSCRIPT> + <A HREF="allclasses-noframe.html"><B>All Classes</B></A> +</NOSCRIPT> + + +</FONT></TD> +</TR> +</TABLE> +<A NAME="skip-navbar_bottom"></A> +<!-- ======== END OF BOTTOM NAVBAR ======= --> + +<HR> +Copyright © 2009 The Apache Software Foundation +</BODY> +</HTML>
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/api/stylesheet.css ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/api/stylesheet.css b/doc/r3.1.2/api/stylesheet.css new file mode 100644 index 0000000..6ea9e51 --- /dev/null +++ b/doc/r3.1.2/api/stylesheet.css @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/broken-links.xml ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/broken-links.xml b/doc/r3.1.2/broken-links.xml new file mode 100644 index 0000000..f95aa9b --- /dev/null +++ b/doc/r3.1.2/broken-links.xml @@ -0,0 +1,2 @@ +<broken-links> +</broken-links> http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/2pc.png ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/2pc.png b/doc/r3.1.2/images/2pc.png new file mode 100644 index 0000000..88ad28d Binary files /dev/null and b/doc/r3.1.2/images/2pc.png differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/built-with-forrest-button.png ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/built-with-forrest-button.png b/doc/r3.1.2/images/built-with-forrest-button.png new file mode 100644 index 0000000..4a787ab Binary files /dev/null and b/doc/r3.1.2/images/built-with-forrest-button.png differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/favicon.ico ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/favicon.ico b/doc/r3.1.2/images/favicon.ico new file mode 100644 index 0000000..161bcf7 Binary files /dev/null and b/doc/r3.1.2/images/favicon.ico differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/hadoop-logo.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/hadoop-logo.jpg b/doc/r3.1.2/images/hadoop-logo.jpg new file mode 100644 index 0000000..809525d Binary files /dev/null and b/doc/r3.1.2/images/hadoop-logo.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/instruction_arrow.png ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/instruction_arrow.png b/doc/r3.1.2/images/instruction_arrow.png new file mode 100644 index 0000000..0fbc724 Binary files /dev/null and b/doc/r3.1.2/images/instruction_arrow.png differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zkcomponents.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zkcomponents.jpg b/doc/r3.1.2/images/zkcomponents.jpg new file mode 100644 index 0000000..7690578 Binary files /dev/null and b/doc/r3.1.2/images/zkcomponents.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zknamespace.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zknamespace.jpg b/doc/r3.1.2/images/zknamespace.jpg new file mode 100644 index 0000000..05534bc Binary files /dev/null and b/doc/r3.1.2/images/zknamespace.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zkperfRW.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zkperfRW.jpg b/doc/r3.1.2/images/zkperfRW.jpg new file mode 100644 index 0000000..ad3019f Binary files /dev/null and b/doc/r3.1.2/images/zkperfRW.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zkperfreliability.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zkperfreliability.jpg b/doc/r3.1.2/images/zkperfreliability.jpg new file mode 100644 index 0000000..232bba8 Binary files /dev/null and b/doc/r3.1.2/images/zkperfreliability.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zkservice.jpg ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zkservice.jpg b/doc/r3.1.2/images/zkservice.jpg new file mode 100644 index 0000000..1ec9154 Binary files /dev/null and b/doc/r3.1.2/images/zkservice.jpg differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/images/zookeeper_small.gif ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/images/zookeeper_small.gif b/doc/r3.1.2/images/zookeeper_small.gif new file mode 100644 index 0000000..4e8014f Binary files /dev/null and b/doc/r3.1.2/images/zookeeper_small.gif differ http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/index.html ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/index.html b/doc/r3.1.2/index.html new file mode 100644 index 0000000..05f3377 --- /dev/null +++ b/doc/r3.1.2/index.html @@ -0,0 +1,336 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta content="Apache Forrest" name="Generator"> +<meta name="Forrest-version" content="0.8"> +<meta name="Forrest-skin-name" content="pelt"> +<title>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</title> +<link type="text/css" href="skin/basic.css" rel="stylesheet"> +<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet"> +<link media="print" type="text/css" href="skin/print.css" rel="stylesheet"> +<link type="text/css" href="skin/profile.css" rel="stylesheet"> +<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script> +<link rel="shortcut icon" href="images/favicon.ico"> +</head> +<body onload="init()"> +<script type="text/javascript">ndeSetTextSize();</script> +<div id="top"> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script> +</div> +<!--+ + |header + +--> +<div class="header"> +<!--+ + |start group logo + +--> +<div class="grouplogo"> +<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a> +</div> +<!--+ + |end group logo + +--> +<!--+ + |start Project Logo + +--> +<div class="projectlogo"> +<a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a> +</div> +<!--+ + |end Project Logo + +--> +<!--+ + |start Search + +--> +<div class="searchbox"> +<form action="http://www.google.com/search" method="get" class="roundtopsmall"> +<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google"> + <input name="Search" value="Search" type="submit"> +</form> +</div> +<!--+ + |end search + +--> +<!--+ + |start Tabs + +--> +<ul id="tabs"> +<li> +<a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a> +</li> +<li> +<a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</li> +<li class="current"> +<a class="selected" href="index.html">ZooKeeper 3.1 Documentation</a> +</li> +</ul> +<!--+ + |end Tabs + +--> +</div> +</div> +<div id="main"> +<div id="publishedStrip"> +<!--+ + |start Subtabs + +--> +<div id="level2tabs"></div> +<!--+ + |end Endtabs + +--> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> + + + </div> +<!--+ + |start Menu, mainarea + +--> +<!--+ + |start Menu + +--> +<div id="menu"> +<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Overview</div> +<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;"> +<div class="menupage"> +<div class="menupagetitle">Welcome</div> +</div> +<div class="menuitem"> +<a href="zookeeperOver.html">Overview</a> +</div> +<div class="menuitem"> +<a href="zookeeperStarted.html">Getting Started</a> +</div> +<div class="menuitem"> +<a href="releasenotes.html">Release Notes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div> +<div id="menu_1.2" class="menuitemgroup"> +<div class="menuitem"> +<a href="api/index.html">API Docs</a> +</div> +<div class="menuitem"> +<a href="zookeeperProgrammers.html">Programmer's Guide</a> +</div> +<div class="menuitem"> +<a href="javaExample.html">Java Example</a> +</div> +<div class="menuitem"> +<a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> +</div> +<div class="menuitem"> +<a href="recipes.html">Recipes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">Admin & Ops</div> +<div id="menu_1.3" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperAdmin.html">Administrator's Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperQuotas.html">Quota Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperJMX.html">JMX</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Contributor</div> +<div id="menu_1.4" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperInternals.html">ZooKeeper Internals</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Miscellaneous</div> +<div id="menu_1.5" class="menuitemgroup"> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</div> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a> +</div> +<div class="menuitem"> +<a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a> +</div> +</div> +<div id="credit"> +<hr> +<a href="http://forrest.apache.org/"><img border="0" title="Built with Apache Forrest" alt="Built with Apache Forrest - logo" src="images/built-with-forrest-button.png" style="width: 88px;height: 31px;"></a> +</div> +<div id="roundbottom"> +<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> +<!--+ + |alternative credits + +--> +<div id="credit2"></div> +</div> +<!--+ + |end Menu + +--> +<!--+ + |start content + +--> +<div id="content"> +<div title="Portable Document Format" class="pdflink"> +<a class="dida" href="index.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br> + PDF</a> +</div> +<h1>ZooKeeper: Because Coordinating Distributed Systems is a Zoo</h1> + +<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="http://hadoop.apache.org/zookeeper/mailing_lists.html">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="releasenotes.html">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="api/index.html">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 & 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> + +</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="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</li> + +<li> +<a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a> +</li> + +</ul> + +</li> + + +</ul> + +</div> +<!--+ + |end content + +--> +<div class="clearboth"> </div> +</div> +<div id="footer"> +<!--+ + |start bottomstrip + +--> +<div class="lastmodified"> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<div class="copyright"> + Copyright © + 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a> +</div> +<div id="logos"></div> +<!--+ + |end bottomstrip + +--> +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/index.pdf ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/index.pdf b/doc/r3.1.2/index.pdf new file mode 100644 index 0000000..2a96db5 --- /dev/null +++ b/doc/r3.1.2/index.pdf @@ -0,0 +1,318 @@ +%PDF-1.3 +%���� +4 0 obj +<< /Type /Info +/Producer (FOP 0.20.5) >> +endobj +5 0 obj +<< /Length 2618 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gatm>99\*g'#*[5n?dA=1,K:MI,nmd4K`oZg"=k!]C?pj$BeL7$(6jBBRbH!:Gb=eP,bs<YQt;;2u<&e".XSic'p*,,/3GHgV_%qr_#21FkjKm"92UVm`#=cZ+V9c[Y=Cpli1r':WC\]qWS7NJV4WJJ,PD(8R!u*n=K5dT9W!3Q,auJs'"/Q$DQhm`5ersWbg9FCbH@6?L!7[[2@!3mmR'VF[cCMSuCb6@4.3l8f^!4Hq!uDJiWsYpmm55VsJYSJ;FM;'hOfKnKsfNa%J-jZg'QgdpSkofZTa(V4GqXQM*;G/V\am`,GA$RFeOk)3K6=m8*UOGu87^6!J\$0AH,PZp9htU]?b[M"b'oZ=@)fRg"]q7olk"6$)?bR@Ym7B)h10UGkc$G($H:He*'?!g-.q>2;GEC0akQ`AqRU=p+asYZ#9hIU@>X*5p$%aR5te)6IZ#Wg>2Nn>d3QOO#G;T'@$VQCa1Rs,BIE$/3Cd5GR4teip6P4-P*fiU?iQ+6jN_%sgrsCNMb'gf^thDX/A\r`F;[cB:?9)4%UNc,]")JXk$TbAI#oBLgN0c4t8Bb&\R&D_]\ZBX(j4j_,hJcO=Yn8jbj2:](B7TK]\=4(Ke_#0-A-@[]H5J`)d[8]pllk:]!eM9nlLcCQGMpC(LUgI\1BjuVN_MEuO1p2,Ks!rMi8)M?<"-E/9ABkmf$qgg+#AL:#C9F$1Y3ElhsTr7?2X*]RgVM;TSE4dRkT2J.<g3qUk^2F2ZXY1cuNCO)?5hYW/dM#&XGqlR6IicZ_a,XhH]i\W#T/Z5Ie)KY+c!(o*BX^Enjh`JT\[%Gp/6s"&"J@N#mm9`h"#IfqmBdKTRmSbF28uuWLS?h;U:E8YG85V,R:>C5"]]lkT%P+ODk:3^3V@f8LX?D-N=\-(#T!kR-gFb9K%Dj`pg;>ff<^g/69YI5=:jDVV5Fs+B<D?*7NRnq-h5%M4HoR1OZg%@K6B4XhsR0d6MX@p/r`L1qOX$@JV Q6XEfJ3DHdB'Sm&%d[97hWdd'OLQ)a^aX\TJn&-,q;@,Z-9O%NH;+Clj20UM>]:ln5@4YE1Kl"bi%SHB-'UFulp8<i1/SQ\gmUfb)WAJJ2VTp074L8FUU@apf&`[SdL[i!M-3,"&NE_Me=HCYaN6kM%"#ans/J`_87qLe]4$'=h@CjlKm:3"F.4Z_HJHV!-F0E%D'F3:;T[VX">]kn515nqXfei7@8IAp\$k4=?hrYCU4Xnf5VHeZO!<r)b8!N22B)OD%3X(HrP\d.Qn%6bChC&i,m!"*_Zo(ANTC`R>A_P)N.LYUX`$&1@O`hm7qI6%mUp&h3].Ds"rq6oiTr%\RJjMP(S<aW(fq(IRMI?9u=ZOii5$*>)]=L;pa_c[Ckdi,`1;5fK4<&SR(=B/ni9TOVZ@H$@8SklHNc=2!s$b[gF'P2T#YoUK$Zj0d&(W(F;"1Xu+'R_#U:caU[fXN_OoUXZlD0-hT63=pIDG7Pm4)S&">,`+jiKg8'l-SejA\V,c<#U#9i?@eJDSX1O3_/7nR$0__QjusVeeLWeWMB,g<Ug"8OW4+cghq*tZ*]>:;i"]]k5QT?T*T"aJIiJ0r@+D=3,[$8ZaenC0QOm,IJ;r9cn!bI'eP/]!efT\<\#cYV)H$1?Lam2?3!`e:BrD\(D+a1Q"G4qL!PP7^-%S:iYd#4(_)uanX0G&m\V4-S$j_m7]&3aFZ2jgh5l!2<bj*I]Oi!`RkJX$o%,6UFf>K5,L[oI-[_B%CdCB_POHL^b8qpQVAM@";JC85R!qkO^4S>Vh-^o"Fit^,&mWP^@paQOI7eTd_'/U/9%nu9^FV<[9g5d(co/(JX?t+u]P,c[K@AsMMc4R*dFf,9E,''?-,%_,.Ptao6_P5L^-@h'08b1FY/Km4[K")AXhCZmq99HNP>Lo7s>nso6's>_`6A-gVG=0j`r\\i;;P``(4Rm(u.NX/gI!dT>./2?B"n(l:5_$6!%Dc\g3;hW9cVV0cpl8i <nY58E3UuGqE_"\gM)Wno&3Q)V8[+?&B*^gDi3^Q6Yon.ine[U(BC18)&9#LH[7B6ECD*M^]IV4Io/pq++60Z.IbfS8b:Xl$O"G'DqUVH&cOb]rj7#"+CI]9%"?*sZ.+?_9\W?"DdB`!\:$DHbFFshWOJ"*\o3o\!@SrDn*Hk,>V+_b;b>.h/*j_#$fqlC6_WRq?c7bqJR\]80#Ig$L2k3I]EGXh_Vh*TD:(erm_UpOmZ9$t$Wph<bVZ:t[p7o]f+<$Ja,uWIL/:2IAe^Gs^:tDe=lMa^<>'<QC,is`H#a+6DB)UhEP.,tk=23pXY+^Y&p3klSg5<N;:AoJU_*N9-SPhH<P%YoI,EB"HcRj'/XfX(I',mt\>s^q/6j0?P#%iZofm,#Ef+^M'd+X!gBTL^Dk6Sp=hHS>li:u&rcM*oSa,/RDh!*>CUJK3[GTP'*oZQ\a6W-^NLl3?F[s>KdYqk"kL8P8`[>;KGj/0"Q/l\7#>(/]fYmIffAfZV3]m1gkhB)^4,pK$Y-+talD/.%]%Ar@^Ia??,C.R%BO%d8R-RbR:*@()2If(3-hO]oF5C_dMjs@"Ra:iL8I:$Q%Zn0PB6SBDWYtOg;]m=:;>AX7V4:!$t~> +endstream +endobj +6 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 5 0 R +/Annots 7 0 R +>> +endobj +7 0 obj +[ +8 0 R +9 0 R +10 0 R +11 0 R +12 0 R +13 0 R +14 0 R +15 0 R +16 0 R +17 0 R +18 0 R +19 0 R +] +endobj +8 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 356.268 471.6 410.616 459.6 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://hadoop.apache.org/zookeeper/mailing_lists.html) +/S /URI >> +/H /I +>> +endobj +9 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 420.0 173.316 408.0 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperOver.html) +/S /URI >> +/H /I +>> +endobj +10 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 393.6 198.996 381.6 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperStarted.html) +/S /URI >> +/H /I +>> +endobj +11 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 367.2 194.316 355.2 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (releasenotes.html) +/S /URI >> +/H /I +>> +endobj +12 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 300.4 172.992 288.4 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (api/index.html) +/S /URI >> +/H /I +>> +endobj +13 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 287.2 225.144 275.2 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperProgrammers.html) +/S /URI >> +/H /I +>> +endobj +14 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 274.0 249.96 262.0 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (javaExample.html) +/S /URI >> +/H /I +>> +endobj +15 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 260.8 256.296 248.8 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperTutorial.html) +/S /URI >> +/H /I +>> +endobj +16 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 247.6 220.968 235.6 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (recipes.html) +/S /URI >> +/H /I +>> +endobj +17 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 180.8 232.488 168.8 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperAdmin.html) +/S /URI >> +/H /I +>> +endobj +18 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 154.4 187.656 142.4 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperQuotas.html) +/S /URI >> +/H /I +>> +endobj +19 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 141.2 150.0 129.2 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperJMX.html) +/S /URI >> +/H /I +>> +endobj +20 0 obj +<< /Length 758 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gat%!a_oie&A@B[k3*l'P*@@m]u=tsZpiB<(/U[I6'Z.QND-pJS03;gC8\^TJM2I^^00?PkHXc)8UsWj+l7G\162FD*s*%_[ZH3!L]HEdr1*_[PeDY*&:^u25*1'l_4kFm\78cX<LNd2^=&kuR-YgAO&41Z(HUAjV5c*6K!IG&fg_GC/EFJqoM-=f_%82"fk@LpoDM^Mi.omUV6hjEe(:-i,?j?F8KG[Ud=5_2FbLe\:FW%5\5D^)n"82qKPqsJ,;a4C'85c=/J&tsLkgVZ!/q'@n,P!-`gb"3f46R)m!Lc)SQ\dD4U>O"$i4u',8UT</Pm@Y-k+D5(_Rmg:<FYY-&kNS?5Tj=.-7"4LN"tC+t60%._0`#]ZX5D$X0*hHENJonHWq!XB]#mk+kC+nWG-e[X3TT@^"N"lo.XS(glhhPspf`WV>M<$LRR3WUdX=B3'nH#`0@uOpTO;XqaG?XN*!Gj<WUVr%:2ggFb;MS;HDbj/b6M6Y7?f7:pGMjlOb63XPolLUYUM"@Y-I:4,HCFKf9Dl>^cL9:E_60%4?<b),LXCU;;ddU/a-LIGOX-`Y_b?sc'_Q/%Z=><[b_"PI=_*Qu)bL]he;)$E['0VSu7KMC3k>.n4HIA+k#kR/K,!"%N4H(AKpC8fT4K"HL>,Ua1j4'0Ggc8#r^D&MU,s6e:qfko:7X64A5c,b\h`aV>U];R<kga/qX=*de.,f[)?oj4bi76h?b-q;S%/fcK9C$t($NP53";KeBm~> +endstream +endobj +21 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 20 0 R +/Annots 22 0 R +>> +endobj +22 0 obj +[ +23 0 R +24 0 R +25 0 R +] +endobj +23 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 630.4 224.964 618.4 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (zookeeperInternals.html) +/S /URI >> +/H /I +>> +endobj +24 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 598.0 150.0 586.0 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://wiki.apache.org/hadoop/ZooKeeper) +/S /URI >> +/H /I +>> +endobj +25 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 126.0 584.8 150.0 572.8 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://wiki.apache.org/hadoop/ZooKeeper/FAQ) +/S /URI >> +/H /I +>> +endobj +26 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F3 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding >> +endobj +27 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F5 +/BaseFont /Times-Roman +/Encoding /WinAnsiEncoding >> +endobj +28 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding >> +endobj +29 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F2 +/BaseFont /Helvetica-Oblique +/Encoding /WinAnsiEncoding >> +endobj +30 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F7 +/BaseFont /Times-Bold +/Encoding /WinAnsiEncoding >> +endobj +1 0 obj +<< /Type /Pages +/Count 2 +/Kids [6 0 R 21 0 R ] >> +endobj +2 0 obj +<< /Type /Catalog +/Pages 1 0 R + >> +endobj +3 0 obj +<< +/Font << /F3 26 0 R /F5 27 0 R /F1 28 0 R /F2 29 0 R /F7 30 0 R >> +/ProcSet [ /PDF /ImageC /Text ] >> +endobj +xref +0 31 +0000000000 65535 f +0000007144 00000 n +0000007209 00000 n +0000007259 00000 n +0000000015 00000 n +0000000071 00000 n +0000002781 00000 n +0000002901 00000 n +0000003002 00000 n +0000003204 00000 n +0000003369 00000 n +0000003538 00000 n +0000003703 00000 n +0000003865 00000 n +0000004038 00000 n +0000004201 00000 n +0000004371 00000 n +0000004531 00000 n +0000004698 00000 n +0000004866 00000 n +0000005029 00000 n +0000005879 00000 n +0000006002 00000 n +0000006043 00000 n +0000006214 00000 n +0000006399 00000 n +0000006588 00000 n +0000006701 00000 n +0000006811 00000 n +0000006919 00000 n +0000007035 00000 n +trailer +<< +/Size 31 +/Root 2 0 R +/Info 4 0 R +>> +startxref +7382 +%%EOF http://git-wip-us.apache.org/repos/asf/zookeeper/blob/01b6b5e4/doc/r3.1.2/javaExample.html ---------------------------------------------------------------------- diff --git a/doc/r3.1.2/javaExample.html b/doc/r3.1.2/javaExample.html new file mode 100644 index 0000000..f127dda --- /dev/null +++ b/doc/r3.1.2/javaExample.html @@ -0,0 +1,888 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta content="Apache Forrest" name="Generator"> +<meta name="Forrest-version" content="0.8"> +<meta name="Forrest-skin-name" content="pelt"> +<title>ZooKeeper Java Example</title> +<link type="text/css" href="skin/basic.css" rel="stylesheet"> +<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet"> +<link media="print" type="text/css" href="skin/print.css" rel="stylesheet"> +<link type="text/css" href="skin/profile.css" rel="stylesheet"> +<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script> +<link rel="shortcut icon" href="images/favicon.ico"> +</head> +<body onload="init()"> +<script type="text/javascript">ndeSetTextSize();</script> +<div id="top"> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script> +</div> +<!--+ + |header + +--> +<div class="header"> +<!--+ + |start group logo + +--> +<div class="grouplogo"> +<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a> +</div> +<!--+ + |end group logo + +--> +<!--+ + |start Project Logo + +--> +<div class="projectlogo"> +<a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a> +</div> +<!--+ + |end Project Logo + +--> +<!--+ + |start Search + +--> +<div class="searchbox"> +<form action="http://www.google.com/search" method="get" class="roundtopsmall"> +<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google"> + <input name="Search" value="Search" type="submit"> +</form> +</div> +<!--+ + |end search + +--> +<!--+ + |start Tabs + +--> +<ul id="tabs"> +<li> +<a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a> +</li> +<li> +<a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</li> +<li class="current"> +<a class="selected" href="index.html">ZooKeeper 3.1 Documentation</a> +</li> +</ul> +<!--+ + |end Tabs + +--> +</div> +</div> +<div id="main"> +<div id="publishedStrip"> +<!--+ + |start Subtabs + +--> +<div id="level2tabs"></div> +<!--+ + |end Endtabs + +--> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> + + + </div> +<!--+ + |start Menu, mainarea + +--> +<!--+ + |start Menu + +--> +<div id="menu"> +<div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Overview</div> +<div id="menu_1.1" class="menuitemgroup"> +<div class="menuitem"> +<a href="index.html">Welcome</a> +</div> +<div class="menuitem"> +<a href="zookeeperOver.html">Overview</a> +</div> +<div class="menuitem"> +<a href="zookeeperStarted.html">Getting Started</a> +</div> +<div class="menuitem"> +<a href="releasenotes.html">Release Notes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_selected_1.2', 'skin/')" id="menu_selected_1.2Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Developer</div> +<div id="menu_selected_1.2" class="selectedmenuitemgroup" style="display: block;"> +<div class="menuitem"> +<a href="api/index.html">API Docs</a> +</div> +<div class="menuitem"> +<a href="zookeeperProgrammers.html">Programmer's Guide</a> +</div> +<div class="menupage"> +<div class="menupagetitle">Java Example</div> +</div> +<div class="menuitem"> +<a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> +</div> +<div class="menuitem"> +<a href="recipes.html">Recipes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">Admin & Ops</div> +<div id="menu_1.3" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperAdmin.html">Administrator's Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperQuotas.html">Quota Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperJMX.html">JMX</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Contributor</div> +<div id="menu_1.4" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperInternals.html">ZooKeeper Internals</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Miscellaneous</div> +<div id="menu_1.5" class="menuitemgroup"> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</div> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a> +</div> +<div class="menuitem"> +<a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a> +</div> +</div> +<div id="credit"></div> +<div id="roundbottom"> +<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> +<!--+ + |alternative credits + +--> +<div id="credit2"></div> +</div> +<!--+ + |end Menu + +--> +<!--+ + |start content + +--> +<div id="content"> +<div title="Portable Document Format" class="pdflink"> +<a class="dida" href="javaExample.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br> + PDF</a> +</div> +<h1>ZooKeeper Java Example</h1> +<div id="minitoc-area"> +<ul class="minitoc"> +<li> +<a href="#ch_Introduction">A Simple Watch Client</a> +<ul class="minitoc"> +<li> +<a href="#sc_requirements">Requirements</a> +</li> +<li> +<a href="#sc_design">Program Design</a> +</li> +</ul> +</li> +<li> +<a href="#sc_executor">The Executor Class</a> +</li> +<li> +<a href="#sc_DataMonitor">The DataMonitor Class</a> +</li> +<li> +<a href="#sc_completeSourceCode">Complete Source Listings</a> +</li> +</ul> +</div> + + + + + +<a name="N10009"></a><a name="ch_Introduction"></a> +<h2 class="h3">A Simple Watch Client</h2> +<div class="section"> +<p>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.</p> +<a name="N10012"></a><a name="sc_requirements"></a> +<h3 class="h4">Requirements</h3> +<p>The client has four requirements:</p> +<ul> +<li> +<p>It takes as parameters:</p> + +<ul> + +<li> +<p>the address of the ZooKeeper service</p> +</li> + +<li> +<p>then name of a znode - the one to be watched</p> +</li> + +<li> +<p>an executable with arguments.</p> +</li> +</ul> +</li> + +<li> +<p>It fetches the data associated with the znode and starts the executable.</p> +</li> + +<li> +<p>If the znode changes, the client refetches the contents and restarts the executable.</p> +</li> + +<li> +<p>If the znode disappears, the client kills the executable.</p> +</li> +</ul> +<a name="N1003B"></a><a name="sc_design"></a> +<h3 class="h4">Program Design</h3> +<p>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 <strong>Executor</strong> + maintains the ZooKeeper connection, and the class called the <strong>DataMonitor</strong> 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.</p> +</div> + + +<a name="N1004C"></a><a name="sc_executor"></a> +<h2 class="h3">The Executor Class</h2> +<div class="section"> +<p>The Executor object is the primary container of the sample application. It contains + both the <strong>ZooKeeper</strong> object, <strong>DataMonitor</strong>, as described above in + <a href="#sc_design">Program Design</a>. </p> +<pre class="code"> + // from the Executor class... + + public static void main(String[] args) { + if (args.length < 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) { + } + } +</pre> +<p> + Recall that the Executor's job is to starts 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: + </p> +<pre class="code"> +public class Executor implements Watcher, Runnable, DataMonitor.DataMonitorListener { +...</pre> +<p>The <strong>Watcher</strong> interface is defined by the ZooKeeper Java API. + ZooKeeper uses it to communicate back to its container. It supports only one method, <span class="codefrag command">process()</span>, 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.)</p> +<pre class="code"> + public void process(WatchedEvent event) { + dm.process(event); + } +</pre> +<p>The <strong>DataMonitorListener</strong> + 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:</p> +<pre class="code"> +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); +} +</pre> +<p>This interface is defined in the DataMonitor class and implemented in the Executor class. + When <span class="codefrag command">Executor.exists()</span> 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 <em>exist</em>. </p> +<p>When <span class="codefrag command">Executor.closing()</span> + is invoked, the Executor decides whether or not to shut itself down in response to the ZooKeeper connection permanently disappearing.</p> +<p>As you might have guessed, DataMonitor is the object that invokes + these methods, in response to changes in ZooKeeper's state.</p> +<p>Here are Executor's implementation of + <span class="codefrag command">DataMonitorListener.exists()</span> and <span class="codefrag command">DataMonitorListener.closing</span>: + </p> +<pre class="code"> +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(); + } +} +</pre> +</div> + +<a name="N100A0"></a><a name="sc_DataMonitor"></a> +<h2 class="h3">The DataMonitor Class</h2> +<div class="section"> +<p> +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:</p> +<pre class="code"> +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 + <strong>zk.exists(znode, true, this, null);</strong> +} +</pre> +<p>The call to <span class="codefrag command">ZooKeeper.exists()</span> checks for the existence of the znode, +sets a watch, and passes a reference to itself (<span class="codefrag command">this</span>) +as the completion callback object. In this sense, it kicks things off, since the +real processing happens when the watch is triggered.</p> +<div class="note"> +<div class="label">Note</div> +<div class="content"> + +<p>Don't confuse the completion callback with the watch callback. The <span class="codefrag command">ZooKeeper.exists()</span> +completion callback, which happens to be the method <span class="codefrag command">StatCallback.processResult()</span> implemented +in the DataMonitor object, is invoked when the asynchronous <em>setting of the watch</em> operation +(by <span class="codefrag command">ZooKeeper.exists()</span>) completes on the server. </p> + +<p> +The triggering of the watch, on the other hand, sends an event to the <em>Executor</em> object, since +the Executor registered as the Watcher of the ZooKeeper object.</p> + + +<p>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.</p> + +</div> +</div> +<p>When the <span class="codefrag command">ZooKeeper.exists()</span> operation completes on the server, the ZooKeeper API invokes this completion callback on +the client:</p> +<pre class="code"> +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 { + <strong>b = zk.getData(znode, false, null);</strong> + } 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 && b != prevData) + || (b != null && !Arrays.equals(prevData, b))) { + <strong>listener.exists(b);</strong> + prevData = b; + } +} +</pre> +<p> +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 <span class="codefrag command">ZooKeeper.getData()</span>, the watch event set by +the <span class="codefrag command">ZooKeeper.exists()</span> triggers a callback; +if there is a communication error, a connection watch event fires when +the connection comes back up. +</p> +<p>Finally, notice how DataMonitor processes watch events: </p> +<pre class="code"> + 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 && 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); + } + } +</pre> +<p> +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 <a href="zookeeperProgrammers.html#ch_zkWatches">ZooKeeper Watches</a> +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 +<span class="codefrag command">ZooKeeper.exists()</span> to find out what has changed. +</p> +</div> + + +<a name="N10104"></a><a name="sc_completeSourceCode"></a> +<h2 class="h3">Complete Source Listings</h2> +<div class="section"> +<div class="note example"> +<div class="label">Executor.java</div> +<div class="content"> +<title>Executor.java</title> +<pre class="code"> +/** + * 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 < 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(); + } + } + } +} +</pre> + + +</div> +</div> +<div class="note example"> +<div class="label">DataMonitor.java</div> +<div class="content"> + +<title>DataMonitor.java</title> + +<pre class="code"> +/** + * 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 && 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 && b != prevData) + || (b != null && !Arrays.equals(prevData, b))) { + listener.exists(b); + prevData = b; + } + } +} +</pre> + +</div> +</div> +</div> + + + + +<p align="right"> +<font size="-2"></font> +</p> +</div> +<!--+ + |end content + +--> +<div class="clearboth"> </div> +</div> +<div id="footer"> +<!--+ + |start bottomstrip + +--> +<div class="lastmodified"> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<div class="copyright"> + Copyright © + 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a> +</div> +<!--+ + |end bottomstrip + +--> +</div> +</body> +</html>