use of com.github.ambry.network.PortType in project ambry by linkedin.
the class DataNode method validatePorts.
private void validatePorts() {
Set<Integer> portNumbers = new HashSet<Integer>();
for (PortType portType : ports.keySet()) {
int portNo = ports.get(portType).getPort();
if (portNumbers.contains(portNo)) {
throw new IllegalStateException("Same port number " + portNo + " found for two port types");
}
if (portNo < MIN_PORT) {
throw new IllegalStateException("Invalid " + portType + " port : " + portNo + " is less than " + MIN_PORT);
} else if (portNo > MAX_PORT) {
throw new IllegalStateException("Invalid " + portType + " port : " + portNo + " is greater than " + MAX_PORT);
}
portNumbers.add(portNo);
}
}