def __init__(self, client, path, num_clients, identifier=None):
"""Create a Double Barrier
:param client: A :class:`~kazoo.client.KazooClient` instance.
:param path: The barrier path to use.
:param num_clients: How many clients must enter the barrier to
proceed.
:type num_clients: int
:param identifier: An identifier to use for this member of the
barrier when participating. Defaults to the
hostname + process id.
"""
self.client = client
self.path = path
self.num_clients = num_clients
self._identifier = identifier or '%s-%s' % (
socket.getfqdn(), os.getpid())
self.participating = False
self.assured_path = False
self.node_name = uuid.uuid4().hex
self.create_path = self.path + "/" + self.node_name
评论列表
文章目录