Fork me on GitHub

Group Member

Description

Group membership management. Adds this instance into a group and keeps a cache of members in the group.

Participating Classes

  • GroupMember
  • PersistentNode
  • PathChildrenCache

Usage

Creating a GroupMember

public GroupMember(CuratorFramework client,
                        String membershipPath,
                        String thisId,
                        byte[] payload)
Parameters:
client - client instance
membershipPath - the path to use for membership
thisId - ID of this group member. MUST be unique for the group
payload - the payload to write in our member node

General Usage

GroupMember must be started:

group.start();

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

group.close();

NOTE: this will remove the instance from the group

You can get a current view of the members by calling:

group.getCurrentMembers();

Error Handling

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