Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAK-11363 : removed usage of Guava's Maps.uniqueIndex #1966

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;

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;
Expand Down Expand Up @@ -273,8 +273,9 @@ public List<GarbageCollectionRepoStats> getStats() throws Exception {
// 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),
Function.identity()));

// Get all the repositories registered
List<DataRecord> repoFiles =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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;

Expand Down Expand Up @@ -93,7 +94,6 @@
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;
Expand Down Expand Up @@ -1523,7 +1523,7 @@ private <T extends Document> Map<UpdateOp, T> bulkUpdate(Collection<T> collectio
}

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) {
Expand Down
Loading