@@ -331,24 +331,25 @@ ZookeeperStore
331331~~~~~~~~~~~~~~
332332
333333.. versionadded :: 4.2
334- The ZookeeperStore was introduced Symfony 4.2.
334+ The ZookeeperStore was introduced in Symfony 4.2.
335335
336- The ZookeeperStore saves locks on a Zookeeper server, it requires a Zookeeper
336+ The ZookeeperStore saves locks on a ` ZooKeeper `_ server. It requires a ZooKeeper
337337connection implementing the ``\Zookeeper `` class. This store does not
338338support blocking and expiration but the lock is automatically released when the
339339PHP process is terminated::
340340
341341 use Symfony\Component\Lock\Store\ZookeeperStore;
342342
343- $zookeeper_server = 'localhost:2181'; // For High Availablity Cluster you can pass 'localhost1:2181,localhost2:2181,localhost3:2181'
344- $zookeeper = new \Zookeeper($zookeeper_server);
343+ $zookeeper = new \Zookeeper('localhost:2181');
344+ // use the following to define a high-availability cluster:
345+ // $zookeeper = new \Zookeeper('localhost1:2181,localhost2:2181,localhost3:2181');
345346
346347 $store = new ZookeeperStore($zookeeper);
347348
348349.. note ::
349350
350- Zookeeper does not require a TTL as the nodes used for locking are ephemeral and die when the PHP process is terminated.
351-
351+ Zookeeper does not require a TTL as the nodes used for locking are ephemeral
352+ and die when the PHP process is terminated.
352353
353354Reliability
354355-----------
@@ -360,9 +361,10 @@ Remote Stores
360361~~~~~~~~~~~~~
361362
362363Remote stores (:ref: `MemcachedStore <lock-store-memcached >`,
363- :ref: `PdoStore <lock-store-pdo >`, :ref: `RedisStore <lock-store-redis >`) and :ref: `ZookeeperStore <lock-store-zookeeper >`)
364- use a unique token to recognize the true owner of the lock. This token is stored
365- in the :class: `Symfony\\ Component\\ Lock\\ Key ` object and is used internally by
364+ :ref: `PdoStore <lock-store-pdo >`, :ref: `RedisStore <lock-store-redis >`) and
365+ :ref: `ZookeeperStore <lock-store-zookeeper >`) use a unique token to recognize
366+ the true owner of the lock. This token is stored in the
367+ :class: `Symfony\\ Component\\ Lock\\ Key ` object and is used internally by
366368the ``Lock ``, therefore this key must not be shared between processes (session,
367369caching, fork, ...).
368370
@@ -589,22 +591,26 @@ can be two running containers in parallel.
589591ZookeeperStore
590592~~~~~~~~~~~~~~
591593
592- The way ZookeeperStore works is by maintaining locks as ephemeral nodes on the server. That means that by using
593- the :ref: `ZookeeperStore <lock-store-zookeeper >` the locks will be automatically released at the end of the session
594- in case the client cannot unlock for any reason.
594+ The way ZookeeperStore works is by maintaining locks as ephemeral nodes on the
595+ server. That means that by using :ref: `ZookeeperStore <lock-store-zookeeper >`
596+ the locks will be automatically released at the end of the session in case the
597+ client cannot unlock for any reason.
595598
596- If the Zookeeper service or the machine hosting it restarts, every lock would
599+ If the ZooKeeper service or the machine hosting it restarts, every lock would
597600be lost without notifying the running processes.
598601
599602.. tip ::
600603
601- To use Zookeeper's High Availability feature, you can setup a cluster of multiple servers so that in case one of
602- the server goes down, the majority will still be up and serving the requests. All the available servers in the
604+ To use ZooKeeper's high-availability feature, you can setup a cluster of
605+ multiple servers so that in case one of the server goes down, the majority
606+ will still be up and serving the requests. All the available servers in the
603607 cluster will see the same state.
604608
605609.. note ::
606- As this store does not support multi-level node locks,
607- since the clean up of intermediate nodes becomes an overhead, all locks are maintained at the root level.
610+
611+ As this store does not support multi-level node locks, since the clean up of
612+ intermediate nodes becomes an overhead, all locks are maintained at the root
613+ level.
608614
609615Overall
610616~~~~~~~
@@ -621,3 +627,4 @@ are still running.
621627.. _`PDO` : https://php.net/pdo
622628.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
623629.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
630+ .. _`ZooKeeper` : https://zookeeper.apache.org/
0 commit comments