/** * Return a new builder. The {@link #address} is set to the ip of the first * NIC in the system. The {@link #id} is set to a random UUID. * * @return builder * @throws Exception errors getting the local IP */ public static<T> ServiceInstanceBuilder<T>builder() throws Exception { String address = null; Collection<InetAddress> ips = ServiceInstanceBuilder.getAllLocalIPs(); if ( ips.size() > 0 ) { address = ips.iterator().next().getHostAddress(); // default to the first address } String id = UUID.randomUUID().toString(); return new ServiceInstanceBuilder<T>().address(address).id(id).registrationTimeUTC(System.currentTimeMillis()); }
/** * Return a new builder. The {@link #address} is set to the ip of the first * NIC in the system. The {@link #id} is set to a random UUID. * * @return builder * @throws Exception errors getting the local IP */ public static<T> ServiceInstanceBuilder<T>builder() throws Exception { String address = null; Collection<InetAddress> ips = ServiceInstanceBuilder.getAllLocalIPs(); if ( ips.size() > 0 ) { address = ips.iterator().next().getHostAddress(); // default to the first address } String id = UUID.randomUUID().toString(); return new ServiceInstanceBuilder<T>().address(address).id(id).registrationTimeUTC(System.currentTimeMillis()); }