Class ServiceInstanceBuilder<T>


  • public class ServiceInstanceBuilder<T>
    extends java.lang.Object
    Builder for service instances
    • Method Detail

      • setLocalIpFilter

        public static void setLocalIpFilter​(LocalIpFilter newLocalIpFilter)
        Replace the default local ip filter used by getAllLocalIPs()
        Parameters:
        newLocalIpFilter - the new local ip filter
      • getLocalIpFilter

        public static LocalIpFilter getLocalIpFilter()
        Return the current local ip filter used by getAllLocalIPs()
        Returns:
        ip filter
      • build

        public ServiceInstance<T> build()
        Return a new instance with the currently set values
        Returns:
        instance
      • getAllLocalIPs

        public static java.util.Collection<java.net.InetAddress> getAllLocalIPs()
                                                                         throws java.net.SocketException
        based on http://pastebin.com/5X073pUc

        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.

        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