@InterfaceAudience.Public public final class StaticHostProvider extends Object implements org.apache.zookeeper.client.HostProvider
Please be aware that although this class doesn't do any DNS caching, there're multiple levels of caching already present across the stack like in JVM, OS level, hardware, etc. The best we could do here is to get the most recent address from the underlying system which is considered up-to-date.
| Modifier and Type | Class and Description |
|---|---|
static interface |
StaticHostProvider.Resolver |
| Constructor and Description |
|---|
StaticHostProvider(Collection<InetSocketAddress> serverAddresses)
Constructs a SimpleHostSet.
|
StaticHostProvider(Collection<InetSocketAddress> serverAddresses,
StaticHostProvider.Resolver resolver)
Introduced for testing purposes.
|
| Modifier and Type | Method and Description |
|---|---|
InetSocketAddress |
next(long spinDelay) |
void |
onConnected() |
int |
size() |
public StaticHostProvider(Collection<InetSocketAddress> serverAddresses)
serverAddresses - possibly unresolved ZooKeeper server addressesIllegalArgumentException - if serverAddresses is empty or resolves to an empty listpublic StaticHostProvider(Collection<InetSocketAddress> serverAddresses, StaticHostProvider.Resolver resolver)
serverAddresses - possibly unresolved ZooKeeper server addressesresolver - custom resolver implementationIllegalArgumentException - if serverAddresses is empty or resolves to an empty listpublic int size()
size in interface org.apache.zookeeper.client.HostProviderpublic InetSocketAddress next(long spinDelay)
next in interface org.apache.zookeeper.client.HostProviderpublic void onConnected()
onConnected in interface org.apache.zookeeper.client.HostProviderCopyright © 2022 The Apache Software Foundation. All rights reserved.