private static AddressDefinition pickLoopbackAddress(String host) throws UnknownHostException { return new AddressDefinition(host, InetAddress.getByName("127.0.0.1")); }
private AddressDefinition getPublicAddress(int port) throws UnknownHostException { String address = config.getProperty("hazelcast.local.publicAddress"); if (address == null) { address = config.getNetworkConfig().getPublicAddress(); } if (address != null) { address = address.trim(); if ("127.0.0.1".equals(address) || "localhost".equals(address)) { return pickLoopbackAddress(address, port); } else { // allow port to be defined in same string in the form of <host>:<port>, e.g. 10.0.0.0:1234 AddressUtil.AddressHolder holder = AddressUtil.getAddressHolder(address, port); return new AddressDefinition(holder.getAddress(), holder.getPort(), InetAddress.getByName(holder.getAddress())); } } return null; }
private AddressDefinition getPublicAddress(int port) throws UnknownHostException { String address = config.getProperty("hazelcast.local.publicAddress"); if (address == null) { address = config.getNetworkConfig().getPublicAddress(); } if (address != null) { address = address.trim(); if ("127.0.0.1".equals(address) || "localhost".equals(address)) { return pickLoopbackAddress(address, port); } else { // allow port to be defined in same string in the form of <host>:<port>, e.g. 10.0.0.0:1234 AddressUtil.AddressHolder holder = AddressUtil.getAddressHolder(address, port); return new AddressDefinition(holder.getAddress(), holder.getPort(), InetAddress.getByName(holder.getAddress())); } } return null; }
private static AddressDefinition pickLoopbackAddress(String host) throws UnknownHostException { return new AddressDefinition(host, InetAddress.getByName("127.0.0.1")); }
private static AddressDefinition pickLoopbackAddress(String host, int defaultPort) throws UnknownHostException { InetAddress address = InetAddress.getByName("127.0.0.1"); return new AddressDefinition(host, defaultPort, address); }
private AddressDefinition getMatchingAddress(Collection<InterfaceDefinition> interfaces, InetAddress inetAddress) { if (isNotEmpty(interfaces)) { return match(inetAddress, interfaces); } else if (!inetAddress.isLoopbackAddress()) { return new AddressDefinition(inetAddress); } return null; }
private AddressDefinition match(InetAddress address, Collection<InterfaceDefinition> interfaces) { for (InterfaceDefinition inf : interfaces) { if (AddressUtil.matchInterface(address.getHostAddress(), inf.address)) { return new AddressDefinition(inf.host, address); } } return null; }
private AddressDefinition getSystemConfiguredAddress() throws UnknownHostException { String address = config.getProperty("hazelcast.local.localAddress"); if (address != null) { address = address.trim(); if ("127.0.0.1".equals(address) || "localhost".equals(address)) { return pickLoopbackAddress(address); } else { logger.info("Picking address configured by property 'hazelcast.local.localAddress'"); return new AddressDefinition(address, InetAddress.getByName(address)); } } return null; }
private static AddressDefinition pickLoopbackAddress(String host, int defaultPort) throws UnknownHostException { InetAddress address = InetAddress.getByName("127.0.0.1"); return new AddressDefinition(host, defaultPort, address); }
private AddressDefinition getSystemConfiguredAddress() throws UnknownHostException { String address = config.getProperty("hazelcast.local.localAddress"); if (address != null) { address = address.trim(); if ("127.0.0.1".equals(address) || "localhost".equals(address)) { return pickLoopbackAddress(address); } else { logger.info("Picking address configured by property 'hazelcast.local.localAddress'"); return new AddressDefinition(address, InetAddress.getByName(address)); } } return null; }
private AddressDefinition match(InetAddress address, Collection<InterfaceDefinition> interfaces) { for (InterfaceDefinition inf : interfaces) { if (AddressUtil.matchInterface(address.getHostAddress(), inf.address)) { return new AddressDefinition(inf.host, address); } } return null; }
private AddressDefinition getMatchingAddress(Collection<InterfaceDefinition> interfaces, InetAddress inetAddress) { if (isNotEmpty(interfaces)) { return match(inetAddress, interfaces); } else if (!inetAddress.isLoopbackAddress()) { return new AddressDefinition(inetAddress); } return null; }