@InterfaceAudience.Public public final class StaticHostProvider extends java.lang.Object implements HostProvider
Constructor and Description |
---|
StaticHostProvider(java.util.Collection<java.net.InetSocketAddress> serverAddresses)
Constructs a SimpleHostSet.
|
StaticHostProvider(java.util.Collection<java.net.InetSocketAddress> serverAddresses,
org.apache.zookeeper.client.StaticHostProvider.Resolver resolver)
Introduced for testing purposes.
|
Modifier and Type | Method and Description |
---|---|
java.net.InetSocketAddress |
next(long spinDelay)
The next host to try to connect to.
|
void |
onConnected()
Notify the HostProvider of a successful connection.
|
int |
size() |
public StaticHostProvider(java.util.Collection<java.net.InetSocketAddress> serverAddresses)
serverAddresses
- possibly unresolved ZooKeeper server addressesjava.lang.IllegalArgumentException
- if serverAddresses is empty or resolves to an empty listpublic StaticHostProvider(java.util.Collection<java.net.InetSocketAddress> serverAddresses, org.apache.zookeeper.client.StaticHostProvider.Resolver resolver)
serverAddresses
- possibly unresolved ZooKeeper server addressesresolver
- custom resolver implementationjava.lang.IllegalArgumentException
- if serverAddresses is empty or resolves to an empty listpublic int size()
size
in interface HostProvider
public java.net.InetSocketAddress next(long spinDelay)
HostProvider
next
in interface HostProvider
spinDelay
- Milliseconds to wait if all hosts have been tried once.public void onConnected()
HostProvider
onConnected
in interface HostProvider
Copyright © 2018 The Apache Software Foundation