public class AdvertiseAddress
extends java.lang.Object
InetSocketAddress
that emphasizes the difference
between an address that should be used for binding a server port and one that
should be advertised to external entities.
An AdvertiseAddress
encourages lazy lookups of port information to
prevent accidentally storing a bind port (e.g. 0 for OS picked) instead of
the advertised port.Constructor and Description |
---|
AdvertiseAddress(java.lang.String host) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getHost() |
int |
getPort() |
int |
hashCode() |
boolean |
isLoopbackAddress() |
static AdvertiseAddress |
newPrivate() |
static AdvertiseAddress |
newPublic()
Best effort method, returns a new
AdvertiseAddress where the host
is determined automatically. |
void |
setPortCallable(java.util.concurrent.Callable<java.lang.Integer> portCallable) |
void |
setStaticPort(int port) |
java.net.InetAddress |
toInetAddress() |
java.net.InetSocketAddress |
toInetSocketAddress() |
java.lang.String |
toString() |
java.net.URI |
toUri(java.lang.String scheme) |
public static AdvertiseAddress newPrivate()
public static AdvertiseAddress newPublic()
AdvertiseAddress
where the host
is determined automatically.AdvertiseAddress
for a publicly accessible
BindAddress
public java.lang.String getHost()
public void setStaticPort(int port)
public int getPort()
public void setPortCallable(java.util.concurrent.Callable<java.lang.Integer> portCallable)
public java.net.InetAddress toInetAddress()
public java.net.InetSocketAddress toInetSocketAddress()
public java.net.URI toUri(java.lang.String scheme)
public boolean isLoopbackAddress()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object