From a0733664441eb64a628ba63b401be7a06a9c070a Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 8 Oct 2026 16:59:31 +0200 Subject: [PATCH] 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 --- .../http/client/ReactorClientHttpRequest.java | 16 ++-------------- .../client/ReactorClientHttpRequestFactory.java | 4 +--- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequest.java index f78dbeeb199..5b9eaccd80d 100644 --- a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequest.java @@ -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 *

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"); diff --git a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequestFactory.java b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequestFactory.java index 5f97142bc29..092a9dc1c3f 100644 --- a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequestFactory.java +++ b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpRequestFactory.java @@ -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); }