CompletableFuture<Optional<File>> getFutureFile(FileReferenceDownload fileReferenceDownload) {
        FileReference fileReference = fileReferenceDownload.fileReference();

        Optional<File> file = getFileFromFileSystem(fileReference);
        if (file.isPresent()) {
            downloads.setDownloadStatus(fileReference, 1.0);
            return CompletableFuture.completedFuture(file);
        } else {
            return startDownload(fileReferenceDownload);
        }
    }
Returns a future that times out if download takes too long, and return empty on unsuccessful download.
filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java