public class ListenerDiscoverer extends Object
Constructor and Description |
---|
ListenerDiscoverer(org.apache.curator.framework.CuratorFramework cf,
ListeningAnnouncerConfig listeningAnnouncerConfig) |
Modifier and Type | Method and Description |
---|---|
Collection<String> |
discoverChildren(String key_base)
Discovers children of the listener key
|
Collection<com.google.common.net.HostAndPort> |
getNewNodes(String listener_key)
Get only nodes that are new since the last time getNewNodes was called (or all nodes if it has never been called)
|
Collection<com.google.common.net.HostAndPort> |
getNodes(String listener_key)
Get nodes at a particular listener.
|
void |
start() |
void |
stop() |
@Inject public ListenerDiscoverer(org.apache.curator.framework.CuratorFramework cf, ListeningAnnouncerConfig listeningAnnouncerConfig)
public void start()
public void stop()
public Collection<com.google.common.net.HostAndPort> getNodes(String listener_key) throws IOException
listener_key
- The Listener's service keyIOException
- if there was an error refreshing the zookeeper cachepublic Collection<com.google.common.net.HostAndPort> getNewNodes(String listener_key) throws IOException
listener_key
- The listener key to look forIOException
- If there was an error in refreshing the Zookeeper cachepublic Collection<String> discoverChildren(@Nullable String key_base) throws IOException
key_base
- The base of the listener key, or null or empty string to get all immediate children of the listener pathIOException
- from CuratorRuntimeException
- for other exceptions from Curator.Copyright © 2011–2017. All rights reserved.