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

daim pushed a commit to branch OAK-11769
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit e47783652168cee60daaba218b70ad8e8163d9c6
Author: Rishabh Kumar <[email protected]>
AuthorDate: Fri Jun 20 15:56:44 2025 +0530

    OAK-11769 : replaced Doubles.fuzzyCompare with commons-math3 Precision
---
 oak-run-elastic/pom.xml                                      |  2 +-
 oak-store-document/pom.xml                                   |  4 ++++
 .../oak/plugins/document/mongo/MongoThrottlerFactory.java    | 12 ++++++------
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/oak-run-elastic/pom.xml b/oak-run-elastic/pom.xml
index 37013d6fe2..8385808b91 100644
--- a/oak-run-elastic/pom.xml
+++ b/oak-run-elastic/pom.xml
@@ -42,7 +42,7 @@
         105 MB: Azure updates
         107 MB: RDB/Tomcat (OAK-10752)
         -->
-        <max.jar.size>117000000</max.jar.size>
+        <max.jar.size>119000000</max.jar.size>
                       
     </properties>
 
diff --git a/oak-store-document/pom.xml b/oak-store-document/pom.xml
index c89f0c37bf..141a4b69a4 100644
--- a/oak-store-document/pom.xml
+++ b/oak-store-document/pom.xml
@@ -152,6 +152,10 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-math3</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.quartz-scheduler</groupId>
       <artifactId>quartz</artifactId>
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoThrottlerFactory.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoThrottlerFactory.java
index a519335366..8cc1816d09 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoThrottlerFactory.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoThrottlerFactory.java
@@ -18,11 +18,11 @@
  */
 package org.apache.jackrabbit.oak.plugins.document.mongo;
 
+import org.apache.commons.math3.util.Precision;
 import org.apache.jackrabbit.guava.common.util.concurrent.AtomicDouble;
 import org.apache.jackrabbit.oak.plugins.document.Throttler;
 import org.jetbrains.annotations.NotNull;
 
-import static org.apache.jackrabbit.guava.common.math.DoubleMath.fuzzyCompare;
 import static java.util.Objects.requireNonNull;
 import static 
org.apache.jackrabbit.oak.plugins.document.Throttler.NO_THROTTLING;
 
@@ -75,16 +75,16 @@ public final class MongoThrottlerFactory {
         @Override
         public long throttlingTime() {
             final double threshold = this.threshold;
-            final double oplogWindow = this.oplogWindow.doubleValue();
+            final double oplogWindow = this.oplogWindow.get();
             long throttleTime = throttlingTime;
 
-            if (fuzzyCompare(oplogWindow,threshold/8,  0.001) <= 0) {
+            if (Precision.compareTo(oplogWindow,threshold/8,  0.001) <= 0) {
                 throttleTime = throttleTime * 8;
-            } else if (fuzzyCompare(oplogWindow,threshold/4, 0.001) <= 0) {
+            } else if (Precision.compareTo(oplogWindow,threshold/4, 0.001) <= 
0) {
                 throttleTime = throttleTime * 4;
-            } else if (fuzzyCompare(oplogWindow, threshold/2, 0.001) <= 0) {
+            } else if (Precision.compareTo(oplogWindow, threshold/2, 0.001) <= 
0) {
                 throttleTime = throttleTime * 2;
-            } else if (fuzzyCompare(oplogWindow, threshold,0.001) <= 0) {
+            } else if (Precision.compareTo(oplogWindow, threshold,0.001) <= 0) 
{
                 throttleTime = throttlingTime;
             } else {
                 throttleTime = 0;

Reply via email to