Compare commits

..

No commits in common. "55d2fbd57fb00f624a9c2a4beff560a57c489d37" and "fb2883d21562ecc12e064443db44062484b24eb5" have entirely different histories.

2 changed files with 6 additions and 7 deletions

View file

@ -130,12 +130,11 @@ protected DownloadTask sendAsync(AsyncDownloader.SizedFile file, URI baseUri, Pa
ProgressTrackingBodyHandler<Path> bodyHandler = makeBodyHandler(targetDir.resolve(file.filePath), callback);
CompletableFuture<HttpResponse<Path>> future = client.sendAsync(makeHttpRequest(baseUri, file.urlPath), bodyHandler);
AtomicReference<DownloadTask> task = new AtomicReference<>(null);
task.set(new DownloadTask(bodyHandler, null /* fix NPE (future already completed) */));
tasks.add(task.get());
task.get().completableFuture = future.thenApply((e) -> {
task.set(new DownloadTask(bodyHandler, future.thenApply((e) -> {
tasks.remove(task.get());
return e;
});
})));
tasks.add(task.get());
return task.get();
}
@ -169,7 +168,7 @@ private static class ConsumerObject {
public static class DownloadTask {
public final ProgressTrackingBodyHandler<Path> bodyHandler;
public CompletableFuture<HttpResponse<Path>> completableFuture;
public final CompletableFuture<HttpResponse<Path>> completableFuture;
public DownloadTask(ProgressTrackingBodyHandler<Path> bodyHandler, CompletableFuture<HttpResponse<Path>> completableFuture) {
this.bodyHandler = bodyHandler;

@ -1 +1 @@
Subproject commit ed433be234a5d6b4336a6af48194add97b0f2874
Subproject commit 828d2483509744aefde1b6082f5a56dc14b4e1e4