Remove unused exchangeTimeout from Reactor HTTP client

Since the deprecated setExchangeTimeout() methods were removed in commit
2b9010c2a2, the exchangeTimeout field in ReactorClientHttpRequestFactory
is never set. Consequently, the corresponding field and package-private
constructor in ReactorClientHttpRequest are effectively dead code.

This commit removes the unused exchangeTimeout support from both
classes. Timeouts are configured via Reactor Netty's HttpClient (for
example, via responseTimeout()).

See gh-33809
This commit is contained in:
Sam Brannen
2026-10-08 17:04:31 +02:00
parent c7233c5132
commit a073366444
2 changed files with 3 additions and 17 deletions
@@ -19,7 +19,6 @@ package org.springframework.http.client;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
import java.time.Duration;
import java.util.concurrent.Executor;
import io.netty.buffer.ByteBuf;
@@ -56,8 +55,6 @@ final class ReactorClientHttpRequest extends AbstractStreamingClientHttpRequest
private final Executor executor;
private final @Nullable Duration exchangeTimeout;
/**
* Create an instance.
@@ -75,24 +72,16 @@ final class ReactorClientHttpRequest extends AbstractStreamingClientHttpRequest
* <p>If no executor is provided, the request will use an {@link Schedulers#boundedElastic() elastic scheduler}
* for performing blocking I/O operations.
* @param httpClient the client to perform the request with
* @param executor the executor to use
* @param method the HTTP method
* @param uri the URI for the request
* @param executor the executor to use
* @since 6.2.13
*/
public ReactorClientHttpRequest(HttpClient httpClient, HttpMethod method, URI uri, @Nullable Executor executor) {
this(httpClient, method, uri, executor, null);
}
/**
* Package private constructor for use until exchangeTimeout is removed.
*/
ReactorClientHttpRequest(HttpClient httpClient, HttpMethod method, URI uri, @Nullable Executor executor, @Nullable Duration exchangeTimeout) {
this.httpClient = httpClient;
this.method = method;
this.uri = uri;
this.executor = (executor != null) ? executor : Schedulers.boundedElastic()::schedule;
this.exchangeTimeout = exchangeTimeout;
}
@@ -121,8 +110,7 @@ final class ReactorClientHttpRequest extends AbstractStreamingClientHttpRequest
.responseConnection((response, conn) -> Mono.just(new ReactorClientHttpResponse(response, conn)))
.next();
ReactorClientHttpResponse clientResponse =
(this.exchangeTimeout != null ? mono.block(this.exchangeTimeout) : mono.block());
ReactorClientHttpResponse clientResponse = mono.block();
if (clientResponse == null) {
throw new IOException("HTTP exchange resulted in no result");
@@ -67,8 +67,6 @@ public class ReactorClientHttpRequestFactory implements ClientHttpRequestFactory
private @Nullable Duration readTimeout;
private @Nullable Duration exchangeTimeout;
private volatile @Nullable HttpClient httpClient;
private final Object lifecycleMonitor = new Object();
@@ -201,7 +199,7 @@ public class ReactorClientHttpRequestFactory implements ClientHttpRequestFactory
"Expected HttpClient or ResourceFactory and mapper");
client = createHttpClient(this.resourceFactory, this.mapper);
}
return new ReactorClientHttpRequest(client, httpMethod, uri, this.executor, this.exchangeTimeout);
return new ReactorClientHttpRequest(client, httpMethod, uri, this.executor);
}