Class GroupMember
java.lang.Object
org.apache.curator.framework.recipes.nodes.GroupMember
- All Implemented Interfaces:
Closeable
,AutoCloseable
Group membership management. Adds this instance into a group and
keeps a cache of members in the group
-
Constructor Summary
ConstructorDescriptionGroupMember
(CuratorFramework client, String membershipPath, String thisId) GroupMember
(CuratorFramework client, String membershipPath, String thisId, byte[] payload) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Have thisId leave the group and stop caching membershipReturn the current view of membership.idFromPath
(String path) Given a full ZNode path, return the member IDvoid
setThisData
(byte[] data) Change the data stored in this instance's nodevoid
start()
Start the group membership.
-
Constructor Details
-
GroupMember
- Parameters:
client
- clientmembershipPath
- the path to use for membershipthisId
- ID of this group member. MUST be unique for the group
-
GroupMember
- Parameters:
client
- clientmembershipPath
- the path to use for membershipthisId
- ID of this group member. MUST be unique for the grouppayload
- the payload to write in our member node
-
-
Method Details
-
start
public void start()Start the group membership. Register thisId as a member and begin caching all members -
setThisData
public void setThisData(byte[] data) Change the data stored in this instance's node- Parameters:
data
- new data (cannot be null)
-
close
public void close()Have thisId leave the group and stop caching membership- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getCurrentMembers
Return the current view of membership. The keys are the IDs of the members. The values are each member's payload- Returns:
- membership
-
idFromPath
Given a full ZNode path, return the member ID- Parameters:
path
- full ZNode path- Returns:
- id
-