You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2025/08/20 15:19:54 UTC

(jackrabbit-oak) branch trunk updated: OAK-11656: Remove usage of Guava Suppliers.memoize (#2457)

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

reschke 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 b8ff5ea808  OAK-11656: Remove usage of Guava Suppliers.memoize  (#2457)
b8ff5ea808 is described below

commit b8ff5ea808c6af9c2a96faae6565409916c6a7f8
Author: Julian Reschke <re...@apache.org>
AuthorDate: Wed Aug 20 17:19:49 2025 +0200

     OAK-11656: Remove usage of Guava Suppliers.memoize  (#2457)
---
 oak-commons/pom.xml                                |   1 +
 .../jackrabbit/oak/commons/function/Suppliers.java |  61 ++++++++++++
 .../oak/commons/function/package-info.java         |  26 +++++
 .../oak/commons/function/SuppliersTest.java        | 107 +++++++++++++++++++++
 .../index/property/PropertyIndexEditor.java        |   2 +-
 .../plugins/index/reference/ReferenceEditor.java   |   3 +-
 .../strategy/ContentMirrorStoreStrategyTest.java   |   2 +-
 .../strategy/UniqueEntryStoreStrategyTest.java     |   2 +-
 .../oak/run/osgi/RunnableJobTracker.java           |   5 +-
 .../jackrabbit/oak/segment/SegmentNodeState.java   |   2 +-
 .../jackrabbit/oak/segment/WriterCacheManager.java |   2 +-
 .../plugins/document/DocumentNodeStoreBuilder.java |   4 +-
 .../oak/plugins/document/SplitOperations.java      |   3 +-
 .../mongo/MongoDocumentNodeStoreBuilderBase.java   |   2 +-
 .../document/rdb/RDBDocumentNodeStoreBuilder.java  |   2 +-
 15 files changed, 208 insertions(+), 16 deletions(-)

diff --git a/oak-commons/pom.xml b/oak-commons/pom.xml
index 5a193e03d6..230ac1c761 100644
--- a/oak-commons/pom.xml
+++ b/oak-commons/pom.xml
@@ -51,6 +51,7 @@
               org.apache.jackrabbit.oak.commons.collections,
               org.apache.jackrabbit.oak.commons.conditions,
               org.apache.jackrabbit.oak.commons.concurrent,
+              org.apache.jackrabbit.oak.commons.function,
               org.apache.jackrabbit.oak.commons.forkjoin,
               org.apache.jackrabbit.oak.commons.io,
               org.apache.jackrabbit.oak.commons.json,
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/Suppliers.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/Suppliers.java
new file mode 100644
index 0000000000..1009820da5
--- /dev/null
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/Suppliers.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.commons.function;
+
+import java.util.function.Supplier;
+
+/**
+ * Utility methods for {@link java.util.function.Supplier} handling.
+ */
+public class Suppliers {
+
+    private Suppliers() {
+    }
+
+    /**
+     * Transforms a {@link Supplier} based on a wrapper that evaluates
+     * the given {@code Supplier} at most one time.
+     * <p>
+     * Suppliers returning {@code null} values are allowed; the memoized
+     * Supplier will be return {@code null} when the wrapped one does on
+     * first invocation.
+     * @param <T> return type
+     * @return Supplier based on the given Supplier
+     */
+    public static <T> Supplier<T> memoize(final Supplier<T> computeOnce) {
+        return new Supplier<>() {
+            volatile boolean initialized = false;
+            T result = null;
+
+            @Override
+            public T get() {
+                if (!initialized) {
+                    synchronized (this) {
+                        if (!initialized) {
+                            result = computeOnce.get();
+                            // only set initialized once value is computed and assigned
+                            initialized = true;
+                        }
+                    }
+                }
+                return result;
+            }
+        };
+    }
+}
diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/package-info.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/package-info.java
new file mode 100644
index 0000000000..ddbf6306f5
--- /dev/null
+++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/function/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Oak-internal Utilities for concurrency related topics.
+ */
+@Version("1.0.0")
+@Internal
+package org.apache.jackrabbit.oak.commons.function;
+
+import org.apache.jackrabbit.oak.commons.annotations.Internal;
+import org.osgi.annotation.versioning.Version;
diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/function/SuppliersTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/function/SuppliersTest.java
new file mode 100644
index 0000000000..a5977c0d0a
--- /dev/null
+++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/function/SuppliersTest.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.commons.function;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Supplier;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
+import static org.junit.Assert.assertNull;
+
+public class SuppliersTest {
+
+    @Test
+    public void computeOnce() {
+        AtomicInteger count = new AtomicInteger(0);
+
+        Supplier<Integer> mem = Suppliers.memoize(count::incrementAndGet);
+
+        assertEquals(0, count.get());
+        int c = mem.get();
+        assertEquals(1, c);
+        c = mem.get();
+        assertEquals(1, c);
+    }
+
+    @Test
+    public void nullSupplier() {
+        AtomicInteger count = new AtomicInteger(0);
+
+        Supplier<Object> mem = Suppliers.memoize(new Supplier<Object>() {
+            @Override
+            public Integer get() {
+                count.incrementAndGet();
+                return null;
+            }
+        });
+
+        assertEquals(0, count.get());
+        assertNull(mem.get());
+        assertEquals(1, count.get());
+        mem.get();
+        assertEquals(1, count.get());
+    }
+
+    @Test
+    public void concurrentSupplierAccess() throws Exception {
+        AtomicInteger sourceSupplierInvocationCount = new AtomicInteger(0);
+        AtomicBoolean concurrencyTestFailed = new AtomicBoolean(false);
+
+        Supplier<AtomicInteger> sourceSupplier = () -> {
+            sourceSupplierInvocationCount.incrementAndGet();
+            return new AtomicInteger(42);
+        };
+        Supplier<AtomicInteger> memoizeTestSupplier = memoize(sourceSupplier);
+
+        int threadCount = 1000;
+        CountDownLatch startSignal = new CountDownLatch(1);
+        CountDownLatch doneSignal = new CountDownLatch(threadCount);
+        List<Thread> threads = new ArrayList<>();
+        for (int k = 0; k < threadCount; k++) {
+            threads.add(new Thread(() -> {
+                try {
+                    startSignal.await();
+                    AtomicInteger result = memoizeTestSupplier.get();
+                    if (result == null || result.get() != 42) {
+                        concurrencyTestFailed.set(true);
+                    }
+                } catch (InterruptedException e) {
+                    // this can be safely ignored.
+                } finally {
+                    doneSignal.countDown();
+                }
+            }));
+        }
+        for (int k = 0; k < threadCount; k++) {
+            threads.get(k).start();
+        }
+        startSignal.countDown();
+        doneSignal.await();
+        assertFalse(concurrencyTestFailed.get());
+        assertEquals(1, sourceSupplierInvocationCount.get());
+    }
+}
diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java
index f843010e85..623381d8c8 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.property;
 
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
 import static java.util.Collections.singleton;
 import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
 import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
@@ -24,6 +23,7 @@ import static org.apache.jackrabbit.oak.api.CommitFailedException.CONSTRAINT;
 import static org.apache.jackrabbit.oak.api.Type.NAME;
 import static org.apache.jackrabbit.oak.api.Type.NAMES;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.DECLARING_NODE_TYPES;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_CONTENT_NODE_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.PROPERTY_NAMES;
diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
index ae339d7ffb..eafca9e362 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.reference;
 
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
-
 import static java.util.Collections.emptySet;
 import static javax.jcr.PropertyType.REFERENCE;
 import static javax.jcr.PropertyType.WEAKREFERENCE;
@@ -27,6 +25,7 @@ import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
 import static org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.REF_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.WEAK_REF_NAME;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.MISSING_NODE;
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
index 5e56e0a426..3fe4fc554e 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.plugins.index.property.strategy;
 
 import static java.util.Arrays.asList;
 
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.ENTRY_COUNT_PROPERTY_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_CONTENT_NODE_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.KEY_COUNT_PROPERTY_NAME;
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategyTest.java
index 9952b78633..2a31b9edfb 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategyTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategyTest.java
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.property.strategy;
 
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_CONTENT_NODE_NAME;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 import static org.hamcrest.Matchers.containsInAnyOrder;
diff --git a/oak-pojosr/src/main/java/org/apache/jackrabbit/oak/run/osgi/RunnableJobTracker.java b/oak-pojosr/src/main/java/org/apache/jackrabbit/oak/run/osgi/RunnableJobTracker.java
index 02adefc769..107cd6a4bf 100644
--- a/oak-pojosr/src/main/java/org/apache/jackrabbit/oak/run/osgi/RunnableJobTracker.java
+++ b/oak-pojosr/src/main/java/org/apache/jackrabbit/oak/run/osgi/RunnableJobTracker.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.jackrabbit.oak.run.osgi;
 
 import java.io.Closeable;
@@ -25,9 +24,9 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Supplier;
 
-import org.apache.jackrabbit.guava.common.base.Suppliers;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.apache.jackrabbit.oak.commons.function.Suppliers;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.Filter;
@@ -43,7 +42,7 @@ public class RunnableJobTracker extends ServiceTracker<Runnable, Future>
      * Lazily loaded executor
      */
     private final Supplier<ScheduledExecutorService> executor =
-            Suppliers.memoize(() -> Oak.defaultScheduledExecutor());
+            Suppliers.memoize(Oak::defaultScheduledExecutor);
 
     public RunnableJobTracker(BundleContext context) {
         super(context, createFilter(), null);
diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java
index c546b16f13..df18008358 100644
--- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java
+++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java
@@ -22,7 +22,6 @@ import static java.util.Collections.emptyList;
 import static java.util.Collections.singletonList;
 import static java.util.Objects.requireNonNull;
 import static org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument;
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
 import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
 import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
 import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
@@ -31,6 +30,7 @@ import static org.apache.jackrabbit.oak.api.Type.NAME;
 import static org.apache.jackrabbit.oak.api.Type.NAMES;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.MISSING_NODE;
 import static org.apache.jackrabbit.oak.spi.state.AbstractNodeState.checkValidName;
diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java
index 702e911ed1..d2e1f9ddab 100644
--- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java
+++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java
@@ -19,8 +19,8 @@
 package org.apache.jackrabbit.oak.segment;
 
 import static java.util.Objects.requireNonNull;
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
 import static java.lang.Integer.getInteger;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.segment.RecordCache.newRecordCache;
 
 import java.util.Iterator;
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
index c221769e21..b14c69257b 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
@@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 
-import org.apache.jackrabbit.guava.common.base.Suppliers;
 import org.apache.jackrabbit.guava.common.cache.Cache;
 import org.apache.jackrabbit.guava.common.cache.CacheBuilder;
 import org.apache.jackrabbit.guava.common.cache.RemovalCause;
@@ -47,6 +46,7 @@ import org.apache.jackrabbit.oak.cache.CacheStats;
 import org.apache.jackrabbit.oak.cache.CacheValue;
 import org.apache.jackrabbit.oak.cache.EmpiricalWeigher;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.function.Suppliers;
 import org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats;
 import org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore;
 import org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob;
@@ -117,7 +117,7 @@ public class DocumentNodeStoreBuilder<T extends DocumentNodeStoreBuilder<T>> {
      */
     static final int UPDATE_LIMIT = Integer.getInteger("update.limit", DEFAULT_UPDATE_LIMIT);
 
-    protected Supplier<DocumentStore> documentStoreSupplier = Suppliers.memoize(() -> new MemoryDocumentStore());
+    protected Supplier<DocumentStore> documentStoreSupplier = Suppliers.memoize(MemoryDocumentStore::new);
     protected Supplier<BlobStore> blobStoreSupplier;
     private DiffCache diffCache;
     private int clusterId  = Integer.getInteger("oak.documentMK.clusterId", 0);
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitOperations.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitOperations.java
index e5457b8a47..66aab19ab7 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitOperations.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitOperations.java
@@ -34,6 +34,7 @@ import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
 import org.apache.jackrabbit.oak.commons.collections.StreamUtils;
+import org.apache.jackrabbit.oak.commons.function.Suppliers;
 import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.jetbrains.annotations.NotNull;
@@ -41,8 +42,6 @@ import org.jetbrains.annotations.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.jackrabbit.guava.common.base.Suppliers;
-
 import static java.util.Objects.requireNonNull;
 
 import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.COMMIT_ROOT;
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
index 7a636c5886..95ab7fc0b2 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderBase.java
@@ -32,7 +32,7 @@ import org.apache.jackrabbit.oak.plugins.document.VersionGCSupport;
 import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
 import org.jetbrains.annotations.NotNull;
 
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 import static org.apache.jackrabbit.oak.plugins.document.mongo.MongoDBConnection.newMongoDBConnection;
 
 /**
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilder.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilder.java
index cede15f1b7..1a36a6869e 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilder.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilder.java
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.oak.plugins.document.rdb;
 
 import static java.util.Set.of;
-import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
+import static org.apache.jackrabbit.oak.commons.function.Suppliers.memoize;
 
 import javax.sql.DataSource;