array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'zookeeper.construct.php', 1 => 'Zookeeper::__construct', ), 'up' => array ( 0 => 'class.zookeeper.php', 1 => 'Zookeeper', ), 'prev' => array ( 0 => 'zookeeper.connect.php', 1 => 'Zookeeper::connect', ), 'next' => array ( 0 => 'zookeeper.create.php', 1 => 'Zookeeper::create', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/zookeeper/zookeeper/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL zookeeper >= 0.1.0)
Zookeeper::__construct — Create a handle to used communicate with zookeeper
$host
= '', callable $watcher_cb
= null
, int $recv_timeout
= 10000)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.
host
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"
watcher_cb
the global watcher callback function. When notifications are triggered this function will be invoked.
recv_timeout
the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE).
This method emits PHP error/warning when parameters count or types are wrong or could not init instance.
Since version 0.3.0, this method emits ZookeeperException and it's derivatives.