private static void importRecursively(File dir,
                                          ExecutorService executor,
                                          Map<String, Future<ImportedMlModel>> models,
                                          Collection<MlModelImporter> importers,
                                          Map<String, String> skippedModels) {
        if ( ! dir.isDirectory()) return;

        Arrays.stream(dir.listFiles()).sorted().forEach(child -> {
            Optional<MlModelImporter> importer = findImporterOf(child, importers);
            if (importer.isPresent()) {
                validateModelPath(child);
                String name = toName(child);
                Future<ImportedMlModel> existing = models.get(name);
                if (existing != null) {
                    try {
                        throw new IllegalArgumentException("The models in " + child + " and " + existing.get().source() +
                                                           " both resolve to the model name '" + name + "'");
                    } catch (InterruptedException | ExecutionException e) {}
                }

                Future<ImportedMlModel> future = executor.submit(() -> {
                    try {
                        return importer.get().importModel(name, child);
                    } catch (RuntimeException e) {
                        skippedModels.put(name, e.getMessage());
                    }
                    return null;
                });
                models.put(name, future);
            }
            else {
                importRecursively(child, executor, models, importers, skippedModels);
            }
        });
    }
Returns an immutable collection of all the imported models
model-integration/src/main/java/ai/vespa/rankingexpression/importer/configmodelview/ImportedMlModels.java