public Future<Optional<File>> getFutureFileOrTimeout(FileReferenceDownload fileReferenceDownload) {
        return getFutureFile(fileReferenceDownload)
                .orTimeout(timeout.toMillis(), TimeUnit.MILLISECONDS)
                .exceptionally(thrown -> {
                    fileReferenceDownloader.failedDownloading(fileReferenceDownload.fileReference());
                    return Optional.empty();
                });
    }
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