byte[] address = null;
try {
address = InetAddress.getByName(hostName).getAddress();
} catch (UnknownHostException ex) {
throw new CLBRuntimeException("Unknown host (" + hostName +
") specified as host name ", ex);
}
long ip;
long portLong;
long first;
long second;
long third;
long fourth;
// Use IP and port
if (address.length == 4) {
ip = getValue(address, 0);
hash = (hash ^ ip) & 0xFFFFFFFFL;
portLong = (long) (port << 16);
hash = (hash ^ portLong) & 0xFFFFFFFFL;
} else if (address.length == 16) {
ip = getValue(address, 0);
hash = (hash ^ ip) & 0xFFFFFFFFL;
ip = getValue(address, 4);
hash = (hash ^ ip) & 0xFFFFFFFFL;
ip = getValue(address, 8);
hash = (hash ^ ip) & 0xFFFFFFFFL;
ip = getValue(address, 12);
hash = (hash ^ ip) & 0xFFFFFFFFL;
portLong = (long) (port << 16);
hash = (hash ^ portLong) & 0xFFFFFFFFL;
} else {
throw new CLBRuntimeException("Unknown address format");
}
return hash;
}