Class DelegateZooKeeperGroup<T extends NodeState>
java.lang.Object
org.apache.camel.component.zookeepermaster.group.internal.DelegateZooKeeperGroup<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Group<T>
- Direct Known Subclasses:
DelegateZooKeeperMultiGroup
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(GroupListener<T> listener) Registers a listener which will be called when the cluster membership changes or the group is connected or disconnected.void
close()
A member should be closed to release acquired resources used to monitor the group membership.createGroup
(org.apache.curator.framework.CuratorFramework client, String path, Class<T> clazz) protected void
doStart()
protected void
doStop()
getGroup()
Gets the last state.boolean
Are we connected with the cluster?boolean
isMaster()
Check if we are the master.master()
Retrieve the master node.members()
Get the list of members connected to this group.void
remove
(GroupListener<T> listener) Removes a previously added listener.slaves()
Retrieve the list of slaves.void
start()
Start this membervoid
Update the state of this group member.void
useCurator
(org.apache.curator.framework.CuratorFramework curator)
-
Constructor Details
-
DelegateZooKeeperGroup
-
-
Method Details
-
useCurator
public void useCurator(org.apache.curator.framework.CuratorFramework curator) -
createGroup
-
add
Description copied from interface:Group
Registers a listener which will be called when the cluster membership changes or the group is connected or disconnected. -
remove
Description copied from interface:Group
Removes a previously added listener. -
isConnected
public boolean isConnected()Description copied from interface:Group
Are we connected with the cluster?- Specified by:
isConnected
in interfaceGroup<T extends NodeState>
-
start
public void start()Description copied from interface:Group
Start this member -
doStart
protected void doStart() -
close
Description copied from interface:Group
A member should be closed to release acquired resources used to monitor the group membership. When the member is closed, any memberships registered via this Group will be removed from the group.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceGroup<T extends NodeState>
- Throws:
IOException
-
doStop
protected void doStop() -
update
Description copied from interface:Group
Update the state of this group member. If the state is null, the member will leave the group. This method can be called even if the group is not started, in which case the state will be stored and updated when the group becomes started. -
members
Description copied from interface:Group
Get the list of members connected to this group. -
isMaster
public boolean isMaster()Description copied from interface:Group
Check if we are the master. -
master
Description copied from interface:Group
Retrieve the master node. -
slaves
Description copied from interface:Group
Retrieve the list of slaves. -
getGroup
-
getLastState
Description copied from interface:Group
Gets the last state. This can be used by clients to access that last state, such as when the clients is being added as alistener
but wants to retrieve the last state to be up to date when the client is added.- Specified by:
getLastState
in interfaceGroup<T extends NodeState>
- Returns:
- the state, or null if no last state yet.
-