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 TypeMethodDescriptionvoidadd(GroupListener<T> listener) Registers a listener which will be called when the cluster membership changes or the group is connected or disconnected.voidclose()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 voiddoStart()protected voiddoStop()getGroup()Gets the last state.booleanAre we connected with the cluster?booleanisMaster()Check if we are the master.master()Retrieve the master node.members()Get the list of members connected to this group.voidremove(GroupListener<T> listener) Removes a previously added listener.slaves()Retrieve the list of slaves.voidstart()Start this membervoidUpdate the state of this group member.voiduseCurator(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:GroupRegisters a listener which will be called when the cluster membership changes or the group is connected or disconnected. -
remove
Description copied from interface:GroupRemoves a previously added listener. -
isConnected
public boolean isConnected()Description copied from interface:GroupAre we connected with the cluster?- Specified by:
isConnectedin interfaceGroup<T extends NodeState>
-
start
public void start()Description copied from interface:GroupStart this member -
doStart
protected void doStart() -
close
Description copied from interface:GroupA 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceGroup<T extends NodeState>- Throws:
IOException
-
doStop
protected void doStop() -
update
Description copied from interface:GroupUpdate 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:GroupGet the list of members connected to this group. -
isMaster
public boolean isMaster()Description copied from interface:GroupCheck if we are the master. -
master
Description copied from interface:GroupRetrieve the master node. -
slaves
Description copied from interface:GroupRetrieve the list of slaves. -
getGroup
-
getLastState
Description copied from interface:GroupGets the last state. This can be used by clients to access that last state, such as when the clients is being added as alistenerbut wants to retrieve the last state to be up to date when the client is added.- Specified by:
getLastStatein interfaceGroup<T extends NodeState>- Returns:
- the state, or null if no last state yet.
-