code: private Optional<String> getPreferredNode(final List<String> nodeNames) {
  
      for (final String nodeName : nodeNames) {
        final String possibleRack = this.racksPerNode.get(nodeName);
        if (possibleRack != null && this.freeNodesPerRack.get(possibleRack).containsKey(nodeName)) {
          return Optional.of(nodeName);
        }
      }
  
      return Optional.empty();
    }
docs: Returns the node name of the container to be allocated if it's available,
  selected from the list of preferred node names.
  If the list is empty, then an empty optional is returned.
  @param nodeNames the list of preferred nodes.
  @return the node name where to allocate the container.