<!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"> <title>Create a handle to used communicate with zookeeper</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="zookeeper.connect.html">Zookeeper::connect</a></div> <div class="next" style="text-align: right; float: right;"><a href="zookeeper.create.html">Zookeeper::create</a></div> <div class="up"><a href="class.zookeeper.html">Zookeeper</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="zookeeper.construct" class="refentry"> <div class="refnamediv"> <h1 class="refname">Zookeeper::__construct</h1> <p class="verinfo">(PECL zookeeper >= 0.1.0)</p><p class="refpurpose"><span class="refname">Zookeeper::__construct</span> — <span class="dc-title">Create a handle to used communicate with zookeeper</span></p> </div> <div class="refsect1 description" id="refsect1-zookeeper.construct-description"> <h3 class="title">Description</h3> <div class="constructorsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>Zookeeper::__construct</strong></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code><span class="initializer"> = ''</span></span> [, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$watcher_cb</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$recv_timeout</code><span class="initializer"> = 10000</span></span> ]]] )</div> <p class="para rdfs-comment"> This method creates a new handle and a zookeeper session that corresponds to that handle. Session establishment is asynchronous, meaning that the session should not be considered established until (and unless) an event of state ZOO_CONNECTED_STATE is received. </p> </div> <div class="refsect1 parameters" id="refsect1-zookeeper.construct-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">host</code></dt> <dd> <p class="para"> comma separated host:port pairs, each corresponding to a zk server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" </p> </dd> <dt> <code class="parameter">watcher_cb</code></dt> <dd> <p class="para"> the global watcher callback function. When notifications are triggered this function will be invoked. </p> </dd> <dt> <code class="parameter">recv_timeout</code></dt> <dd> <p class="para"> the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE). </p> </dd> </dl> </div> <div class="refsect1 errors" id="refsect1-zookeeper.construct-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> This method emits PHP error/warning when parameters count or types are wrong or could not init instance. </p> <div class="caution"><strong class="caution">Caution</strong> <p class="para"> Since version 0.3.0, this method emits <strong class="classname">ZookeeperException</strong> and it's derivatives. </p> </div> </div> <div class="refsect1 seealso" id="refsect1-zookeeper.construct-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"><span class="methodname"><a href="zookeeper.connect.html" class="methodname" rel="rdfs-seeAlso">Zookeeper::connect()</a> - Create a handle to used communicate with zookeeper</span></li> <li class="member"><strong class="classname">ZookeeperException</strong></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="zookeeper.connect.html">Zookeeper::connect</a></div> <div class="next" style="text-align: right; float: right;"><a href="zookeeper.create.html">Zookeeper::create</a></div> <div class="up"><a href="class.zookeeper.html">Zookeeper</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>