final TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
final String host = tcpIpConfig.getRequiredMember();
try {
final AddressHolder addressHolder = AddressUtil.getAddressHolder(host, config.getNetworkConfig().getPort());
if (AddressUtil.isIpAddress(addressHolder.address)) {
return new Address(addressHolder.address, addressHolder.port);
} else {
final InterfacesConfig interfaces = config.getNetworkConfig().getInterfaces();
if (interfaces.isEnabled()) {
final InetAddress[] inetAddresses = InetAddress.getAllByName(addressHolder.address);
if (inetAddresses.length > 1) {
for (InetAddress inetAddress : inetAddresses) {
if (AddressUtil.matchAnyInterface(inetAddress.getHostAddress(),
interfaces.getInterfaces())) {
return new Address(inetAddress, addressHolder.port);
}
}
} else {
final InetAddress inetAddress = inetAddresses[0];
if (AddressUtil.matchAnyInterface(inetAddress.getHostAddress(),
interfaces.getInterfaces())) {
return new Address(addressHolder.address, addressHolder.port);
}
}
} else {
return new Address(addressHolder.address, addressHolder.port);
}
}
} catch (final Exception e) {
logger.warning( e);
}