This is an automated email from the ASF dual-hosted git repository. jdyer pushed a commit to branch feature/SOLR-17516-c in repository https://gitbox.apache.org/repos/asf/solr.git
commit 565cfad4373f9dcc33382144e0bd9144ebdf578c Author: jdyer1 <[email protected]> AuthorDate: Thu Oct 31 09:44:29 2024 -0500 cleanup --- .../solr/client/solrj/impl/LBHttp2SolrClient.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java index 3f39e5aaf55..c5fddc16aed 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java @@ -100,7 +100,7 @@ public class LBHttp2SolrClient<C extends HttpSolrClientBase> extends LBSolrClien protected final C solrClient; @SuppressWarnings("unchecked") - protected LBHttp2SolrClient(Builder<?> builder) { + private LBHttp2SolrClient(Builder<?> builder) { super(Arrays.asList(builder.solrEndpoints)); this.solrClient = (C) builder.solrClient; this.aliveCheckIntervalMillis = builder.aliveCheckIntervalMillis; @@ -287,16 +287,13 @@ public class LBHttp2SolrClient<C extends HttpSolrClientBase> extends LBSolrClien } public static class Builder<C extends HttpSolrClientBase> { - final C solrClient; - protected final LBSolrClient.Endpoint[] solrEndpoints; - long aliveCheckIntervalMillis = + + private final C solrClient; + private final LBSolrClient.Endpoint[] solrEndpoints; + private long aliveCheckIntervalMillis = TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS); // 1 minute between checks protected String defaultCollection; - public LBHttp2SolrClient<C> build() { - return new LBHttp2SolrClient<C>(this); - } - public Builder(C http2Client, LBSolrClient.Endpoint... endpoints) { this.solrClient = http2Client; this.solrEndpoints = endpoints; @@ -308,7 +305,6 @@ public class LBHttp2SolrClient<C extends HttpSolrClientBase> extends LBSolrClien * * @param aliveCheckInterval how often to ping for aliveness */ - @SuppressWarnings("unchecked") public Builder<C> setAliveCheckInterval(int aliveCheckInterval, TimeUnit unit) { if (aliveCheckInterval <= 0) { throw new IllegalArgumentException( @@ -319,10 +315,13 @@ public class LBHttp2SolrClient<C extends HttpSolrClientBase> extends LBSolrClien } /** Sets a default for core or collection based requests. */ - @SuppressWarnings("unchecked") public Builder<C> withDefaultCollection(String defaultCoreOrCollection) { this.defaultCollection = defaultCoreOrCollection; return this; } + + public LBHttp2SolrClient<C> build() { + return new LBHttp2SolrClient<C>(this); + } } }
