public class ServiceInstanceBuilder<T> extends Object
Modifier and Type | Method and Description |
---|---|
ServiceInstanceBuilder<T> |
address(String address) |
ServiceInstance<T> |
build()
Return a new instance with the currently set values
|
ServiceInstanceBuilder<T> |
enabled(boolean enabled) |
static Collection<InetAddress> |
getAllLocalIPs()
based on http://pastebin.com/5X073pUc
|
static LocalIpFilter |
getLocalIpFilter()
Return the current local ip filter used by
getAllLocalIPs() |
ServiceInstanceBuilder<T> |
id(String id) |
ServiceInstanceBuilder<T> |
name(String name) |
ServiceInstanceBuilder<T> |
payload(T payload) |
ServiceInstanceBuilder<T> |
port(int port) |
ServiceInstanceBuilder<T> |
registrationTimeUTC(long registrationTimeUTC) |
ServiceInstanceBuilder<T> |
serviceType(ServiceType serviceType) |
static void |
setLocalIpFilter(LocalIpFilter newLocalIpFilter)
Replace the default local ip filter used by
getAllLocalIPs() |
ServiceInstanceBuilder<T> |
sslPort(int port) |
ServiceInstanceBuilder<T> |
uriSpec(UriSpec uriSpec) |
public static void setLocalIpFilter(LocalIpFilter newLocalIpFilter)
getAllLocalIPs()
newLocalIpFilter
- the new local ip filterpublic static LocalIpFilter getLocalIpFilter()
getAllLocalIPs()
public ServiceInstance<T> build()
public ServiceInstanceBuilder<T> name(String name)
public ServiceInstanceBuilder<T> address(String address)
public ServiceInstanceBuilder<T> id(String id)
public ServiceInstanceBuilder<T> port(int port)
public ServiceInstanceBuilder<T> sslPort(int port)
public ServiceInstanceBuilder<T> payload(T payload)
public ServiceInstanceBuilder<T> serviceType(ServiceType serviceType)
public ServiceInstanceBuilder<T> registrationTimeUTC(long registrationTimeUTC)
public ServiceInstanceBuilder<T> uriSpec(UriSpec uriSpec)
public ServiceInstanceBuilder<T> enabled(boolean enabled)
public static Collection<InetAddress> getAllLocalIPs() throws SocketException
Returns all available IP addresses.
In error case or if no network connection is established, we return an empty list here.
Loopback addresses are excluded - so 127.0.0.1 will not be never returned.
The "primary" IP might not be the first one in the returned list.
SocketException
- errorsCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.