private void deleteUnusedFiles(File directory) {

        File[] files = directory.listFiles();
        if (files == null) return;

        List<File> filesToDelete = filesThatCanBeDeleted(files);
        filesToDelete.forEach(fileReference -> {
            if (IOUtils.recursiveDeleteDir(fileReference))
                log.log(Level.FINE, "Deleted " + fileReference.getAbsolutePath());
            else
                log.log(Level.WARNING, "Could not delete " + fileReference.getAbsolutePath());
        });
    }
Deletes file references and url downloads that have not been used for some time.
See {@link com.yahoo.vespa.config.proxy.filedistribution.RequestTracker} for how we track
when a file reference or download was last used.

@author hmusum
config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileReferencesAndDownloadsMaintainer.java