|
18 | 18 | */ |
19 | 19 | package org.apache.jackrabbit.oak.plugins.document.mongo; |
20 | 20 |
|
| 21 | +import org.apache.commons.math3.util.Precision; |
21 | 22 | import org.apache.jackrabbit.guava.common.util.concurrent.AtomicDouble; |
22 | 23 | import org.apache.jackrabbit.oak.plugins.document.Throttler; |
23 | 24 | import org.jetbrains.annotations.NotNull; |
24 | 25 |
|
25 | | -import static org.apache.jackrabbit.guava.common.math.DoubleMath.fuzzyCompare; |
26 | 26 | import static java.util.Objects.requireNonNull; |
27 | 27 | import static org.apache.jackrabbit.oak.plugins.document.Throttler.NO_THROTTLING; |
28 | 28 |
|
@@ -75,16 +75,16 @@ public ExponentialThrottler(final int threshold, final @NotNull AtomicDouble opl |
75 | 75 | @Override |
76 | 76 | public long throttlingTime() { |
77 | 77 | final double threshold = this.threshold; |
78 | | - final double oplogWindow = this.oplogWindow.doubleValue(); |
| 78 | + final double oplogWindow = this.oplogWindow.get(); |
79 | 79 | long throttleTime = throttlingTime; |
80 | 80 |
|
81 | | - if (fuzzyCompare(oplogWindow,threshold/8, 0.001) <= 0) { |
| 81 | + if (Precision.compareTo(oplogWindow,threshold/8, 0.001) <= 0) { |
82 | 82 | throttleTime = throttleTime * 8; |
83 | | - } else if (fuzzyCompare(oplogWindow,threshold/4, 0.001) <= 0) { |
| 83 | + } else if (Precision.compareTo(oplogWindow,threshold/4, 0.001) <= 0) { |
84 | 84 | throttleTime = throttleTime * 4; |
85 | | - } else if (fuzzyCompare(oplogWindow, threshold/2, 0.001) <= 0) { |
| 85 | + } else if (Precision.compareTo(oplogWindow, threshold/2, 0.001) <= 0) { |
86 | 86 | throttleTime = throttleTime * 2; |
87 | | - } else if (fuzzyCompare(oplogWindow, threshold,0.001) <= 0) { |
| 87 | + } else if (Precision.compareTo(oplogWindow, threshold,0.001) <= 0) { |
88 | 88 | throttleTime = throttlingTime; |
89 | 89 | } else { |
90 | 90 | throttleTime = 0; |
|
0 commit comments