Skip to content

Commit ae20f9d

Browse files
committed
Minor tweaks
1 parent 6218472 commit ae20f9d

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

components/lock.rst

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
337337
connection implementing the ``\Zookeeper`` class. This store does not
338338
support blocking and expiration but the lock is automatically released when the
339339
PHP 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

353354
Reliability
354355
-----------
@@ -360,9 +361,10 @@ Remote Stores
360361
~~~~~~~~~~~~~
361362

362363
Remote 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
366368
the ``Lock``, therefore this key must not be shared between processes (session,
367369
caching, fork, ...).
368370

@@ -589,22 +591,26 @@ can be two running containers in parallel.
589591
ZookeeperStore
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
597600
be 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

609615
Overall
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

Comments
 (0)