Fork me on GitHub

Persistent Node


A persistent node is a node that attempts to stay present in ZooKeeper, even through connection and session interruptions.

Participating Classes

  • PersistentNode


Creating a PersistentNode

public PersistentNode(CuratorFramework client,
                               CreateMode mode,
                               boolean useProtection,
                               String basePath,
                               byte[] data)
client - client instance
mode - creation mode
useProtection - if true, call CreateBuilder.withProtection()
basePath - the base path for the node
data - data for the node

General Usage

PersistentNodes must be started:


When you are through with the PersistentNode instance, you should call close:


NOTE: this will delete the node

Error Handling

PersistentNode instances internally handle all error states recreating the node as necessary.