@@ -713,7 +713,8 @@ static class SuccessRateOutlierEjectionAlgorithm implements OutlierEjectionAlgor
713713 public  void  ejectOutliers (AddressTrackerMap  trackerMap , long  ejectionTimeNanos ) {
714714
715715 // Only consider addresses that have the minimum request volume specified in the config. 
716-  List <AddressTracker > trackersWithVolume  = trackersWithVolume (trackerMap , config );
716+  List <AddressTracker > trackersWithVolume  = trackersWithVolume (trackerMap ,
717+  config .successRateEjection .requestVolume );
717718 // If we don't have enough addresses with significant volume then there's nothing to do. 
718719 if  (trackersWithVolume .size () < config .successRateEjection .minimumHosts 
719720 || trackersWithVolume .size () == 0 ) {
@@ -749,18 +750,6 @@ public void ejectOutliers(AddressTrackerMap trackerMap, long ejectionTimeNanos)
749750 }
750751 }
751752
752-  /** Returns only the trackers that have the minimum configured volume to be considered. */ 
753-  private  List <AddressTracker > trackersWithVolume (AddressTrackerMap  trackerMap ,
754-  OutlierDetectionLoadBalancerConfig  config ) {
755-  List <AddressTracker > trackersWithVolume  = new  ArrayList <>();
756-  for  (AddressTracker  tracker  : trackerMap .values ()) {
757-  if  (tracker .inactiveVolume () >= config .successRateEjection .requestVolume ) {
758-  trackersWithVolume .add (tracker );
759-  }
760-  }
761-  return  trackersWithVolume ;
762-  }
763- 
764753 /** Calculates the mean of the given values. */ 
765754 @ VisibleForTesting 
766755 static  double  mean (Collection <Double > values ) {
@@ -797,13 +786,17 @@ static class FailurePercentageOutlierEjectionAlgorithm implements OutlierEjectio
797786 @ Override 
798787 public  void  ejectOutliers (AddressTrackerMap  trackerMap , long  ejectionTimeNanos ) {
799788
800-  // If we don't have the minimum amount of addresses the config calls for, then return. 
801-  if  (trackerMap .size () < config .failurePercentageEjection .minimumHosts ) {
789+  // Only consider addresses that have the minimum request volume specified in the config. 
790+  List <AddressTracker > trackersWithVolume  = trackersWithVolume (trackerMap ,
791+  config .failurePercentageEjection .requestVolume );
792+  // If we don't have enough addresses with significant volume then there's nothing to do. 
793+  if  (trackersWithVolume .size () < config .failurePercentageEjection .minimumHosts 
794+  || trackersWithVolume .size () == 0 ) {
802795 return ;
803796 }
804797
805798 // If this address does not have enough volume to be considered, skip to the next one. 
806-  for  (AddressTracker  tracker  : trackerMap . values () ) {
799+  for  (AddressTracker  tracker  : trackersWithVolume ) {
807800 // If we are above the max ejection percentage, don't eject any more. This will allow the 
808801 // total ejections to go one above the max, but at the same time it assures at least one 
809802 // ejection, which the spec calls for. This behavior matches what Envoy proxy does. 
@@ -827,6 +820,18 @@ public void ejectOutliers(AddressTrackerMap trackerMap, long ejectionTimeNanos)
827820 }
828821 }
829822
823+  /** Returns only the trackers that have the minimum configured volume to be considered. */ 
824+  private  static  List <AddressTracker > trackersWithVolume (AddressTrackerMap  trackerMap ,
825+  int  volume ) {
826+  List <AddressTracker > trackersWithVolume  = new  ArrayList <>();
827+  for  (AddressTracker  tracker  : trackerMap .values ()) {
828+  if  (tracker .inactiveVolume () >= volume ) {
829+  trackersWithVolume .add (tracker );
830+  }
831+  }
832+  return  trackersWithVolume ;
833+  }
834+ 
830835 /** Counts how many addresses are in a given address group. */ 
831836 private  static  boolean  hasSingleAddress (List <EquivalentAddressGroup > addressGroups ) {
832837 int  addressCount  = 0 ;
0 commit comments