From e45345876ee6a2fcf11b739867fc40d109fdb25b Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Thu, 27 Jun 2024 09:54:40 +0200 Subject: [PATCH] Use CompletedFuture from core --- .../client5/http/impl/cache/DefaultAsyncCacheRevalidator.java | 4 ++-- .../main/java/org/apache/hc/client5/http/impl/Operations.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java index 50c89a825..33a33941b 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java @@ -33,8 +33,8 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.hc.client5.http.async.AsyncExecCallback; -import org.apache.hc.client5.http.impl.Operations; import org.apache.hc.client5.http.schedule.SchedulingStrategy; +import org.apache.hc.core5.concurrent.CompletedFuture; import org.apache.hc.core5.http.EntityDetails; import org.apache.hc.core5.http.HttpException; import org.apache.hc.core5.http.HttpResponse; @@ -70,7 +70,7 @@ static class InternalScheduledExecutor implements ScheduledExecutor { public Future schedule(final Runnable command, final TimeValue timeValue) throws RejectedExecutionException { if (timeValue.toMilliseconds() <= 0) { command.run(); - return new Operations.CompletedFuture(null); + return new CompletedFuture<>(null); } return executor.schedule(command, timeValue); } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/Operations.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/Operations.java index afa232b0a..64d79a7e3 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/Operations.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/Operations.java @@ -48,7 +48,10 @@ public final class Operations { * The outcome of the future cannot be altered and it cannot be cancelled. * * @param operation result representation. + * + * @deprecated Use {@link org.apache.hc.core5.concurrent.CompletedFuture}. */ + @Deprecated public static class CompletedFuture implements Future { private final T result;