You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2019/08/28 15:47:33 UTC

[lucene-solr] branch branch_8x updated: SOLR-13257: Cleanup code and make the AffinityReplicaTransformer constructors private (#848) (#849)

This is an automated email from the ASF dual-hosted git repository.

anshum pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 7c101fb  SOLR-13257: Cleanup code and make the AffinityReplicaTransformer constructors private (#848) (#849)
7c101fb is described below

commit 7c101fba4a38e8cd1240d2ee057dc0329f52fea1
Author: Anshum Gupta <an...@apache.org>
AuthorDate: Wed Aug 28 08:47:25 2019 -0700

    SOLR-13257: Cleanup code and make the AffinityReplicaTransformer constructors private (#848) (#849)
    
    SOLR-13257: Cleanup code and make the constructors private as the constructor is supposed to be called via the static getInstance method.
---
 .../component/AffinityReplicaListTransformer.java     | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/component/AffinityReplicaListTransformer.java b/solr/core/src/java/org/apache/solr/handler/component/AffinityReplicaListTransformer.java
index 94334f2..420c111 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/AffinityReplicaListTransformer.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/AffinityReplicaListTransformer.java
@@ -16,17 +16,15 @@
  */
 package org.apache.solr.handler.component;
 
-import java.lang.invoke.MethodHandles;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
+
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.Hash;
 import org.apache.solr.request.SolrQueryRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Allows better caching by establishing deterministic evenly-distributed replica routing preferences according to
@@ -35,15 +33,13 @@ import org.slf4j.LoggerFactory;
  */
 class AffinityReplicaListTransformer implements ReplicaListTransformer {
 
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
   private final int routingDividend;
 
-  public AffinityReplicaListTransformer(String hashVal) {
+  private AffinityReplicaListTransformer(String hashVal) {
     this.routingDividend = Math.abs(Hash.lookup3ycs(hashVal, 0, hashVal.length(), 0));
   }
 
-  public AffinityReplicaListTransformer(int routingDividend) {
+  private AffinityReplicaListTransformer(int routingDividend) {
     this.routingDividend = routingDividend;
   }
 
@@ -107,12 +103,5 @@ class AffinityReplicaListTransformer implements ReplicaListTransformer {
 
   }
 
-  private static final Comparator<SortableChoice> SORTABLE_CHOICE_COMPARATOR = new Comparator<SortableChoice>() {
-
-    @Override
-    public int compare(SortableChoice o1, SortableChoice o2) {
-      return o1.sortableCoreLabel.compareTo(o2.sortableCoreLabel);
-    }
-  };
-
+  private static final Comparator<SortableChoice> SORTABLE_CHOICE_COMPARATOR = Comparator.comparing(o -> o.sortableCoreLabel);
 }