public class DelegateZooKeeperGroup<T extends NodeState> extends Object implements Group<T>
Constructor and Description |
---|
DelegateZooKeeperGroup(String path,
Class<T> clazz) |
Modifier and Type | Method and Description |
---|---|
void |
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.
|
protected Group<T> |
createGroup(org.apache.curator.framework.CuratorFramework client,
String path,
Class<T> clazz) |
protected void |
doStart() |
protected void |
doStop() |
Group<T> |
getGroup() |
T |
getLastState()
Gets the last state.
|
boolean |
isConnected()
Are we connected with the cluster?
|
boolean |
isMaster()
Check if we are the master.
|
T |
master()
Retrieve the master node.
|
Map<String,T> |
members()
Get the list of members connected to this group.
|
void |
remove(GroupListener<T> listener)
Removes a previously added listener.
|
List<T> |
slaves()
Retrieve the list of slaves.
|
void |
start()
Start this member
|
void |
update(T state)
Update the state of this group member.
|
void |
useCurator(org.apache.curator.framework.CuratorFramework curator) |
public void useCurator(org.apache.curator.framework.CuratorFramework curator)
protected Group<T> createGroup(org.apache.curator.framework.CuratorFramework client, String path, Class<T> clazz)
public void add(GroupListener<T> listener)
Group
public void remove(GroupListener<T> listener)
Group
public boolean isConnected()
Group
isConnected
in interface Group<T extends NodeState>
public void start()
Group
protected void doStart()
public void close() throws IOException
Group
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Group<T extends NodeState>
IOException
protected void doStop() throws IOException
IOException
public void update(T state)
Group
public Map<String,T> members()
Group
public boolean isMaster()
Group
public List<T> slaves()
Group
public T getLastState()
Group
listener
but wants to retrieve the last state to be up to date when the
client is added.getLastState
in interface Group<T extends NodeState>
Apache Camel