Search in sources :

Example 1 with PortType

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);
    }
}
Also used : HashSet(java.util.HashSet) PortType(com.github.ambry.network.PortType)

Aggregations

PortType (com.github.ambry.network.PortType)1 HashSet (java.util.HashSet)1