private static int findServerId(Map<Integer, ZooKeeperAddress> servers, int currentServerId, NetworkInterface iface) { for (final Enumeration<InetAddress> ea = iface.getInetAddresses(); ea.hasMoreElements();) { currentServerId = findServerId(servers, currentServerId, ea.nextElement()); } return currentServerId; }
private static int findServerId(Map<Integer, ZooKeeperAddress> servers, int currentServerId, NetworkInterface iface) { for (final Enumeration<InetAddress> ea = iface.getInetAddresses(); ea.hasMoreElements();) { currentServerId = findServerId(servers, currentServerId, ea.nextElement()); } return currentServerId; }
private static int findServerId(Map<Integer, ZooKeeperAddress> servers, int currentServerId, NetworkInterface iface) { for (final Enumeration<InetAddress> ea = iface.getInetAddresses(); ea.hasMoreElements();) { currentServerId = findServerId(servers, currentServerId, ea.nextElement()); } return currentServerId; }
private static int findServerId(Map<Integer, ZooKeeperAddress> servers) { int serverId = -1; try { for (final Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();) { serverId = findServerId(servers, serverId, e.nextElement()); } } catch (SocketException e) { throw new IllegalStateException("failed to retrieve the network interface list", e); } if (serverId < 0) { throw new IllegalStateException( "failed to auto-detect server ID because there is no matching IP address."); } return serverId; }
private static int findServerId(Map<Integer, ZooKeeperAddress> servers) { int serverId = -1; try { for (final Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();) { serverId = findServerId(servers, serverId, e.nextElement()); } } catch (SocketException e) { throw new IllegalStateException("failed to retrieve the network interface list", e); } if (serverId < 0) { throw new IllegalStateException( "failed to auto-detect server ID because there is no matching IP address."); } return serverId; }
private static int findServerId(Map<Integer, ZooKeeperAddress> servers) { int serverId = -1; try { for (final Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();) { serverId = findServerId(servers, serverId, e.nextElement()); } } catch (SocketException e) { throw new IllegalStateException("failed to retrieve the network interface list", e); } if (serverId < 0) { throw new IllegalStateException( "failed to auto-detect server ID because there is no matching IP address."); } return serverId; }
this.serverId = serverId != null ? serverId : findServerId(servers); checkArgument(this.serverId > 0, "serverId: %s (expected: > 0)", serverId);
this.serverId = serverId != null ? serverId : findServerId(servers); checkArgument(this.serverId > 0, "serverId: %s (expected: > 0)", serverId);
this.serverId = serverId != null ? serverId : findServerId(servers); checkArgument(this.serverId > 0, "serverId: %s (expected: > 0)", serverId);