public Set<Integer> getUsedPorts(SupervisorDetails supervisor) {
        Map<String, SchedulerAssignment> assignments = this.getAssignments();
        Set<Integer> usedPorts = new HashSet<>();

        for (SchedulerAssignment assignment : assignments.values()) {
            for (WorkerSlot slot : assignment.getExecutorToSlot().values()) {
                if (slot.getNodeId().equals(supervisor.getId())) {
                    usedPorts.add(slot.getPort());
                }
            }
        }

        return usedPorts;
    }
public Set < Integer > getUsedPorts ( SupervisorDetails supervisor ) { Map < String , SchedulerAssignment > assignments = this . getAssignments ( ) ; Set < Integer > usedPorts = new HashSet < > ( ) ; for ( SchedulerAssignment assignment : assignments . values ( ) ) { for ( WorkerSlot slot : assignment . getExecutorToSlot ( ) . values ( ) ) { if ( slot . getNodeId ( ) . equals ( supervisor . getId ( ) ) ) { usedPorts . add ( slot . getPort ( ) ) ; } } } return usedPorts ; }
Get all the used ports of this supervisor.