This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push: new b9c3070c74 OAK-11769 : replaced DoubleMath.fuzzyCompare with commons-math3 Precision (#2345) b9c3070c74 is described below commit b9c3070c74906311516645e3452026b90281ef05 Author: Rishabh Kumar <rishabhdaim1...@gmail.com> AuthorDate: Mon Jun 23 20:54:21 2025 +0530 OAK-11769 : replaced DoubleMath.fuzzyCompare with commons-math3 Precision (#2345) * OAK-11769 : replaced Doubles.fuzzyCompare with commons-math3 Precision * OAK-11769 : added apache commons-math3 to test-bundles.xml --------- Co-authored-by: Rishabh Kumar <d...@adobe.com> --- oak-it-osgi/test-bundles.xml | 1 + oak-run-elastic/pom.xml | 2 +- oak-store-document/pom.xml | 4 ++++ .../oak/plugins/document/mongo/MongoThrottlerFactory.java | 10 +++++----- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/oak-it-osgi/test-bundles.xml b/oak-it-osgi/test-bundles.xml index b21a048825..bb4c32c814 100644 --- a/oak-it-osgi/test-bundles.xml +++ b/oak-it-osgi/test-bundles.xml @@ -39,6 +39,7 @@ <include>commons-logging:commons-logging</include> <include>com.fasterxml.jackson.core:jackson-core</include> <include>org.apache.commons:commons-lang3</include> + <include>org.apache.commons:commons-math3</include> <include>org.apache.commons:commons-text</include> <include>org.apache.commons:commons-collections4</include> <include>org.apache.jackrabbit:jackrabbit-jcr-commons</include> 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..30fbf23998 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; @@ -78,13 +78,13 @@ public final class MongoThrottlerFactory { final double oplogWindow = this.oplogWindow.doubleValue(); 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;