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.
|
static void |
closeQuietly(Closeable closeable) |
protected Group<T> |
createGroup(org.apache.curator.framework.CuratorFramework client,
String path,
Class<T> clazz) |
protected void |
doStart() |
protected void |
doStop() |
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)
Grouppublic void remove(GroupListener<T> listener)
Grouppublic boolean isConnected()
GroupisConnected in interface Group<T extends NodeState>public void start()
Groupprotected void doStart()
public void close()
throws IOException
Groupclose in interface Group<T extends NodeState>close in interface Closeableclose in interface AutoCloseableIOExceptionprotected void doStop()
throws IOException
IOExceptionpublic void update(T state)
Grouppublic Map<String,T> members()
Grouppublic boolean isMaster()
Grouppublic List<T> slaves()
Grouppublic T getLastState()
Grouplistener but wants to retrieve the last state to be up to date when the
client is added.getLastState in interface Group<T extends NodeState>public static void closeQuietly(Closeable closeable)
Copyright © 2011–2015 Red Hat. All rights reserved.