private void waitUntilDownloadStarted(FileReferenceDownload fileReferenceDownload) {
        Instant end = Instant.now().plus(downloadTimeout);
        FileReference fileReference = fileReferenceDownload.fileReference();
        int retryCount = 0;
        Connection connection = connectionPool.getCurrent();
        do {
            if (retryCount > 0)
                backoff(retryCount, end);

            if (shutDown.get())
                return;
            if (FileDownloader.fileReferenceExists(fileReference, downloadDirectory))
                return;
            var timeout = rpcTimeout.orElse(Duration.between(Instant.now(), end));
            log.log(Level.FINE, "Wait until download of " + fileReference + " has started, retryCount " + retryCount +
                    ", timeout " + timeout + " (request from " + fileReferenceDownload.client() + ")");
            if ( ! timeout.isNegative() && startDownloadRpc(fileReferenceDownload, retryCount, connection, timeout))
                return;

            retryCount++;
            // There might not be one connection that works for all file references (each file reference might
            // exist on just one config server, and which one could be different for each file reference), so
            // switch to a new connection for every retry
            connection = connectionPool.switchConnection(connection);
        } while (Instant.now().isBefore(end));

        fileReferenceDownload.future().completeExceptionally(new RuntimeException("Failed getting " + fileReference));
        downloads.remove(fileReference);
    }
Downloads file reference from config server and keeps track of files being downloaded

@author hmusum
filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java