From ee55bec9f0dc44661e77b6c65b05d1ab586a4cdc Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Wed, 22 Feb 2017 11:19:56 +0000 Subject: [PATCH] SOLR-10173: Make HttpShardHandlerFactory.getReplicaListTransformer more extensible. (Ramsey Haddad via Christine Poerschke) --- solr/CHANGES.txt | 3 +++ .../solr/handler/component/HttpShardHandlerFactory.java | 4 ++-- .../apache/solr/handler/component/ReplicaListTransformer.java | 2 +- .../solr/handler/component/ReplicaListTransformerTest.java | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c3580887259..20666fd409f 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -226,6 +226,9 @@ Other Changes * SOLR-9966: Convert/migrate tests using EasyMock to Mockito (Cao Manh Dat, Uwe Schindler) +* SOLR-10173: Make HttpShardHandlerFactory.getReplicaListTransformer more extensible. + (Ramsey Haddad via Christine Poerschke) + ================== 6.4.2 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java index 87d5c3da50f..83a2d60e72a 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java +++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java @@ -103,7 +103,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org. private HttpClientMetricNameStrategy metricNameStrategy; - private final Random r = new Random(); + protected final Random r = new Random(); private final ReplicaListTransformer shufflingReplicaListTransformer = new ShufflingReplicaListTransformer(r); @@ -318,7 +318,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org. return s != null && s.startsWith(preferredHostAddress); } } - ReplicaListTransformer getReplicaListTransformer(final SolrQueryRequest req) + protected ReplicaListTransformer getReplicaListTransformer(final SolrQueryRequest req) { final SolrParams params = req.getParams(); diff --git a/solr/core/src/java/org/apache/solr/handler/component/ReplicaListTransformer.java b/solr/core/src/java/org/apache/solr/handler/component/ReplicaListTransformer.java index bf30fa61726..b7784e89d86 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/ReplicaListTransformer.java +++ b/solr/core/src/java/org/apache/solr/handler/component/ReplicaListTransformer.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.solr.common.cloud.Replica; import org.apache.solr.common.params.ShardParams; -interface ReplicaListTransformer { +public interface ReplicaListTransformer { /** * Transforms the passed in list of choices. Transformations can include (but are not limited to) diff --git a/solr/core/src/test/org/apache/solr/handler/component/ReplicaListTransformerTest.java b/solr/core/src/test/org/apache/solr/handler/component/ReplicaListTransformerTest.java index 96d23192962..81599712100 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/ReplicaListTransformerTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/ReplicaListTransformerTest.java @@ -94,7 +94,7 @@ public class ReplicaListTransformerTest extends LuceneTestCase { transformer = new HttpShardHandlerFactory() { @Override - ReplicaListTransformer getReplicaListTransformer(final SolrQueryRequest req) + protected ReplicaListTransformer getReplicaListTransformer(final SolrQueryRequest req) { final SolrParams params = req.getParams();