Skip to content

Commit

Permalink
OAK-11349 : removed usage of Guava's Maps.newIdentityHashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh Kumar committed Jan 6, 2025
1 parent 0c77da0 commit 129d0d1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.jackrabbit.oak.benchmark;

import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.UUID;

Expand All @@ -27,8 +28,6 @@

import org.apache.jackrabbit.oak.fixture.RepositoryFixture;

import org.apache.jackrabbit.guava.common.collect.Maps;

/**
* Test for measuring the performance of setting a single property and
* saving the change.
Expand Down Expand Up @@ -108,7 +107,7 @@ private Map<Thread, Node> getOrCreateNodesMap() {

Map<Thread, Node> nodes = map.get(currentFixtureName);
if (nodes == null) {
nodes = Maps.newIdentityHashMap();
nodes = new IdentityHashMap<>();
}
return nodes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
Expand All @@ -39,7 +40,6 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.apache.jackrabbit.guava.common.collect.Maps;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -377,7 +377,7 @@ public static <K> Set<K> newLinkedHashSet(final int capacity) {
*/
@NotNull
public static <E> Set<E> newIdentityHashSet() {
return Collections.newSetFromMap(Maps.newIdentityHashMap());
return Collections.newSetFromMap(new IdentityHashMap<>());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -97,8 +98,6 @@
import org.junit.Ignore;
import org.junit.Test;

import org.apache.jackrabbit.guava.common.collect.Maps;

import ch.qos.logback.classic.Level;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.MISSING_NODE;

Expand Down Expand Up @@ -521,7 +520,7 @@ public void run() {
// OAK-1784
@Test
public void failOnConflict() throws Exception {
final Map<Thread, Semaphore> locks = Maps.newIdentityHashMap();
final Map<Thread, Semaphore> locks = new IdentityHashMap<>();
NodeStore store = new MemoryNodeStore() {
@NotNull
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.util.Objects.requireNonNull;

import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
Expand All @@ -31,8 +32,6 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

import org.apache.jackrabbit.guava.common.collect.Maps;

import org.apache.jackrabbit.oak.stats.StatisticsProvider;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
Expand All @@ -56,7 +55,7 @@ final class CommitQueue {
/**
* Map of currently suspended commits until a given Revision is visible.
*/
private final Map<Semaphore, SuspendedCommit> suspendedCommits = Maps.newIdentityHashMap();
private final Map<Semaphore, SuspendedCommit> suspendedCommits = new IdentityHashMap<>();

private final RevisionContext context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.jackrabbit.guava.common.collect.Maps;

import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.plugins.document.util.TimingDocumentStoreWrapper;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
Expand Down Expand Up @@ -61,7 +60,7 @@ public class VersionGCWithSplitTest {

private Clock clock;

private Map<Thread, Semaphore> updateLocks = Maps.newIdentityHashMap();
private Map<Thread, Semaphore> updateLocks = new IdentityHashMap<>();

private DocumentNodeStore store;

Expand Down

0 comments on commit 129d0d1

Please sign in to comment.