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 da...@apache.org on 2025/01/09 09:46:44 UTC
(jackrabbit-oak) branch OAK-11363 created (now 82faccf1a2)
This is an automated email from the ASF dual-hosted git repository.
daim pushed a change to branch OAK-11363
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
at 82faccf1a2 OAK-11363 : removed usage of Guava's Maps.uniqueIndex
This branch includes the following new commits:
new 82faccf1a2 OAK-11363 : removed usage of Guava's Maps.uniqueIndex
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(jackrabbit-oak) 01/01: OAK-11363 : removed usage of Guava's Maps.uniqueIndex
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
daim pushed a commit to branch OAK-11363
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 82faccf1a25e06b67d55e77144b10407838e09a3
Author: Rishabh Kumar <di...@adobe.com>
AuthorDate: Thu Jan 9 15:16:32 2025 +0530
OAK-11363 : removed usage of Guava's Maps.uniqueIndex
---
.../jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java | 6 +++---
.../jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
index 9a649d71c4..0b17f5778f 100644
--- a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
+++ b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
@@ -57,7 +57,6 @@ import org.apache.commons.collections4.ListValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
import org.apache.jackrabbit.guava.common.collect.Iterators;
-import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.guava.common.io.Closeables;
import org.apache.jackrabbit.guava.common.io.Files;
import org.apache.jackrabbit.guava.common.util.concurrent.ListenableFutureTask;
@@ -273,8 +272,9 @@ public class MarkSweepGarbageCollector implements BlobGarbageCollector {
// Get all the markers available
List<DataRecord> markerFiles =
((SharedDataStore) blobStore).getAllMetadataRecords(SharedStoreRecordType.MARKED_START_MARKER.getType());
- Map<String, DataRecord> markers = Maps.uniqueIndex(markerFiles,
- input -> input.getIdentifier().toString().substring(SharedStoreRecordType.MARKED_START_MARKER.getType().length() + 1));
+ Map<String, DataRecord> markers = markerFiles.stream().collect(Collectors.toUnmodifiableMap(
+ input -> input.getIdentifier().toString().substring(SharedStoreRecordType.MARKED_START_MARKER.getType().length() + 1),
+ input -> input));
// Get all the repositories registered
List<DataRecord> repoFiles =
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
index a4e3eb1a57..e366af793c 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
@@ -37,6 +37,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
+import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@@ -93,7 +94,6 @@ import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.guava.common.collect.Maps;
import com.mongodb.BasicDBObject;
import com.mongodb.MongoException;
import com.mongodb.WriteConcern;
@@ -1523,7 +1523,7 @@ public class MongoDocumentStore implements DocumentStore {
}
private static Map<String, UpdateOp> createMap(List<UpdateOp> updateOps) {
- return Maps.uniqueIndex(updateOps, input -> input.getId());
+ return updateOps.stream().collect(Collectors.toMap(UpdateOp::getId, Function.identity()));
}
private <T extends Document> Map<String, T> findDocuments(Collection<T> collection, Set<String> keys) {