Fork me on GitHub

Persistent Node

Description

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

Participating Classes

  • PersistentNode

Usage

Creating a PersistentNode

public PersistentNode(CuratorFramework client,
                               CreateMode mode,
                               boolean useProtection,
                               String basePath,
                               byte[] data)
Parameters:
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:

node.start();

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

node.close();

NOTE: this will delete the node

Error Handling

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