This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit fdddd5e67d44e6b027a225bd961c657180c1aab4 Author: David Smiley <[email protected]> AuthorDate: Fri Oct 10 20:52:43 2025 -0400 Rename CloudHttp2SolrClient.withInternalClientBuilder (#3632) to withHttpClientBuilder (kept with deprecations) (cherry picked from commit bad307e5a3ed5ba5168d1cfb17b94d9393942058) --- .../solr/prometheus/exporter/SolrClientFactory.java | 2 +- .../org/apache/solr/client/solrj/io/SolrClientCache.java | 2 +- .../solr/client/solrj/impl/CloudHttp2SolrClient.java | 16 ++++++++++------ .../solrj/impl/CloudHttp2SolrClientBuilderTest.java | 8 ++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrClientFactory.java b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrClientFactory.java index ede2495c452..cb8390cb40b 100644 --- a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrClientFactory.java +++ b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrClientFactory.java @@ -76,7 +76,7 @@ public class SolrClientFactory { .collect(Collectors.toList()); CloudSolrClient client = new CloudHttp2SolrClient.Builder(zkHosts, Optional.ofNullable(parser.getChrootPath())) - .withInternalClientBuilder(newHttp2SolrClientBuilder(null, settings, configuration)) + .withHttpClientBuilder(newHttp2SolrClientBuilder(null, settings, configuration)) .withResponseParser(new NoOpResponseParser("json")) .build(); diff --git a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java index f12a4e9a4ed..271cb1bc29f 100644 --- a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java +++ b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java @@ -133,7 +133,7 @@ public class SolrClientCache implements Closeable { var builder = new CloudHttp2SolrClient.Builder(hosts, Optional.empty()); builder.canUseZkACLs(canUseACLs); // using internal builder to ensure the internal client gets closed - builder = builder.withInternalClientBuilder(newHttp2SolrClientBuilder(null, http2SolrClient)); + builder = builder.withHttpClientBuilder(newHttp2SolrClientBuilder(null, http2SolrClient)); var client = builder.build(); try { client.connect(); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java index 92a47fe6380..90e028e15e1 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java @@ -406,21 +406,20 @@ public class CloudHttp2SolrClient extends CloudSolrClient { } /** - * Set the internal http client. + * Set the internal {@link Http2SolrClient}. * - * <p>Note: closing the httpClient instance is at the responsibility of the caller. + * <p>Note: closing the client instance is the responsibility of the caller. * - * @param httpClient http client * @return this * @deprecated Please use {@link #withInternalClientBuilder(Http2SolrClient.Builder)} */ @Deprecated(since = "9.9") - public Builder withHttpClient(Http2SolrClient httpClient) { + public Builder withHttpClient(Http2SolrClient httpSolrClient) { if (this.internalClientBuilder != null) { throw new IllegalStateException( "The builder can't accept an httpClient AND an internalClientBuilder, only one of those can be provided"); } - this.httpClient = httpClient; + this.httpClient = httpSolrClient; return this; } @@ -432,7 +431,7 @@ public class CloudHttp2SolrClient extends CloudSolrClient { * @param internalClientBuilder the builder to use for creating the internal http client. * @return this */ - public Builder withInternalClientBuilder(Http2SolrClient.Builder internalClientBuilder) { + public Builder withHttpClientBuilder(Http2SolrClient.Builder internalClientBuilder) { if (this.httpClient != null) { throw new IllegalStateException( "The builder can't accept an httpClient AND an internalClientBuilder, only one of those can be provided"); @@ -441,6 +440,11 @@ public class CloudHttp2SolrClient extends CloudSolrClient { return this; } + @Deprecated(since = "9.10") + public Builder withInternalClientBuilder(Http2SolrClient.Builder internalClientBuilder) { + return withHttpClientBuilder(internalClientBuilder); + } + /** * Sets the Zk connection timeout * diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBuilderTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBuilderTest.java index 01f57970e99..f293a01ded0 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBuilderTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientBuilderTest.java @@ -129,14 +129,14 @@ public class CloudHttp2SolrClientBuilderTest extends SolrCloudTestCase { new CloudHttp2SolrClient.Builder( Collections.singletonList(ANY_ZK_HOST), Optional.of(ANY_CHROOT)) .withHttpClient(mock(Http2SolrClient.class)) - .withInternalClientBuilder(mock(Http2SolrClient.Builder.class)) + .withHttpClientBuilder(mock(Http2SolrClient.Builder.class)) .build()); expectThrows( IllegalStateException.class, () -> new CloudHttp2SolrClient.Builder( Collections.singletonList(ANY_ZK_HOST), Optional.of(ANY_CHROOT)) - .withInternalClientBuilder(mock(Http2SolrClient.Builder.class)) + .withHttpClientBuilder(mock(Http2SolrClient.Builder.class)) .withHttpClient(mock(Http2SolrClient.class)) .build()); } @@ -149,7 +149,7 @@ public class CloudHttp2SolrClientBuilderTest extends SolrCloudTestCase { CloudHttp2SolrClient.Builder clientBuilder = new CloudHttp2SolrClient.Builder( Collections.singletonList(ANY_ZK_HOST), Optional.of(ANY_CHROOT)) - .withInternalClientBuilder(http2ClientBuilder); + .withHttpClientBuilder(http2ClientBuilder); verify(http2ClientBuilder, never()).build(); try (CloudHttp2SolrClient client = clientBuilder.build()) { assertEquals(http2Client, client.getHttpClient()); @@ -219,7 +219,7 @@ public class CloudHttp2SolrClientBuilderTest extends SolrCloudTestCase { if (httpClient != null) { clientBuilder.withHttpClient(httpClient); } else if (internalClientBuilder != null) { - clientBuilder.withInternalClientBuilder(internalClientBuilder); + clientBuilder.withHttpClientBuilder(internalClientBuilder); } try (CloudHttp2SolrClient client = clientBuilder.build()) {
