mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-16 15:07:27 +00:00
Use CompletedFuture from core
This commit is contained in:
parent
a0bf57b837
commit
e45345876e
@ -33,8 +33,8 @@
|
|||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import org.apache.hc.client5.http.async.AsyncExecCallback;
|
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.client5.http.schedule.SchedulingStrategy;
|
||||||
|
import org.apache.hc.core5.concurrent.CompletedFuture;
|
||||||
import org.apache.hc.core5.http.EntityDetails;
|
import org.apache.hc.core5.http.EntityDetails;
|
||||||
import org.apache.hc.core5.http.HttpException;
|
import org.apache.hc.core5.http.HttpException;
|
||||||
import org.apache.hc.core5.http.HttpResponse;
|
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 {
|
public Future<?> schedule(final Runnable command, final TimeValue timeValue) throws RejectedExecutionException {
|
||||||
if (timeValue.toMilliseconds() <= 0) {
|
if (timeValue.toMilliseconds() <= 0) {
|
||||||
command.run();
|
command.run();
|
||||||
return new Operations.CompletedFuture<Void>(null);
|
return new CompletedFuture<>(null);
|
||||||
}
|
}
|
||||||
return executor.schedule(command, timeValue);
|
return executor.schedule(command, timeValue);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,10 @@ public final class Operations {
|
|||||||
* The outcome of the future cannot be altered and it cannot be cancelled.
|
* The outcome of the future cannot be altered and it cannot be cancelled.
|
||||||
*
|
*
|
||||||
* @param <T> operation result representation.
|
* @param <T> operation result representation.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link org.apache.hc.core5.concurrent.CompletedFuture}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static class CompletedFuture<T> implements Future<T> {
|
public static class CompletedFuture<T> implements Future<T> {
|
||||||
|
|
||||||
private final T result;
|
private final T result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user