Package org.apache.curator.x.discovery
Class ServiceInstanceBuilder<T>
- java.lang.Object
-
- org.apache.curator.x.discovery.ServiceInstanceBuilder<T>
-
public class ServiceInstanceBuilder<T> extends java.lang.ObjectBuilder for service instances
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceInstanceBuilder<T>address(java.lang.String address)ServiceInstance<T>build()Return a new instance with the currently set valuesServiceInstanceBuilder<T>enabled(boolean enabled)static java.util.Collection<java.net.InetAddress>getAllLocalIPs()based on http://pastebin.com/5X073pUcstatic LocalIpFiltergetLocalIpFilter()Return the current local ip filter used bygetAllLocalIPs()ServiceInstanceBuilder<T>id(java.lang.String id)ServiceInstanceBuilder<T>name(java.lang.String name)ServiceInstanceBuilder<T>payload(T payload)ServiceInstanceBuilder<T>port(int port)ServiceInstanceBuilder<T>registrationTimeUTC(long registrationTimeUTC)ServiceInstanceBuilder<T>serviceType(ServiceType serviceType)static voidsetLocalIpFilter(LocalIpFilter newLocalIpFilter)Replace the default local ip filter used bygetAllLocalIPs()ServiceInstanceBuilder<T>sslPort(int port)ServiceInstanceBuilder<T>uriSpec(UriSpec uriSpec)
-
-
-
Method Detail
-
setLocalIpFilter
public static void setLocalIpFilter(LocalIpFilter newLocalIpFilter)
Replace the default local ip filter used bygetAllLocalIPs()- Parameters:
newLocalIpFilter- the new local ip filter
-
getLocalIpFilter
public static LocalIpFilter getLocalIpFilter()
Return the current local ip filter used bygetAllLocalIPs()- Returns:
- ip filter
-
build
public ServiceInstance<T> build()
Return a new instance with the currently set values- Returns:
- instance
-
name
public ServiceInstanceBuilder<T> name(java.lang.String name)
-
address
public ServiceInstanceBuilder<T> address(java.lang.String address)
-
id
public ServiceInstanceBuilder<T> id(java.lang.String id)
-
port
public ServiceInstanceBuilder<T> port(int port)
-
sslPort
public ServiceInstanceBuilder<T> sslPort(int port)
-
payload
public ServiceInstanceBuilder<T> payload(T payload)
-
serviceType
public ServiceInstanceBuilder<T> serviceType(ServiceType serviceType)
-
registrationTimeUTC
public ServiceInstanceBuilder<T> registrationTimeUTC(long registrationTimeUTC)
-
uriSpec
public ServiceInstanceBuilder<T> uriSpec(UriSpec uriSpec)
-
enabled
public ServiceInstanceBuilder<T> enabled(boolean enabled)
-
getAllLocalIPs
public static java.util.Collection<java.net.InetAddress> getAllLocalIPs() throws java.net.SocketExceptionbased on http://pastebin.com/5X073pUcReturns 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.
- Returns:
- Returns all IP addresses (can be an empty list in error case or if network connection is missing).
- Throws:
java.net.SocketException- errors- Since:
- 0.1.0
-
-