function ZookeeperStore::createNewLock
Creates a zookeeper node.
Parameters
string $node The node which needs to be created:
string $value The value to be assigned to a zookeeper node:
Throws
1 call to ZookeeperStore::createNewLock()
- ZookeeperStore::save in vendor/
symfony/ lock/ Store/ ZookeeperStore.php - Stores the resource if it's not locked by someone else.
File
-
vendor/
symfony/ lock/ Store/ ZookeeperStore.php, line 111
Class
- ZookeeperStore
- ZookeeperStore is a PersistingStoreInterface implementation using Zookeeper as store engine.
Namespace
Symfony\Component\Lock\StoreCode
private function createNewLock(string $node, string $value) : void {
// Default Node Permissions
$acl = [
[
'perms' => \Zookeeper::PERM_ALL,
'scheme' => 'world',
'id' => 'anyone',
],
];
// This ensures that the nodes are deleted when the client session to zookeeper server ends.
$type = \Zookeeper::EPHEMERAL;
try {
$this->zookeeper
->create($node, $value, $acl, $type);
} catch (\ZookeeperException $ex) {
if (\Zookeeper::NODEEXISTS === $ex->getCode()) {
throw new LockConflictedException($ex);
}
throw new LockAcquiringException($ex);
}
}