Skip to content

Commit 5d04e22

Browse files
authored
Merge pull request #1947 from apache/OAK-11349
OAK-11348 : removed usage of Guava's Maps.newIdentityHashMap
2 parents ea3f196 + 129d0d1 commit 5d04e22

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/SetPropertyTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.jackrabbit.oak.benchmark;
1818

1919
import java.util.HashMap;
20+
import java.util.IdentityHashMap;
2021
import java.util.Map;
2122
import java.util.UUID;
2223

@@ -27,8 +28,6 @@
2728

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

30-
import org.apache.jackrabbit.guava.common.collect.Maps;
31-
3231
/**
3332
* Test for measuring the performance of setting a single property and
3433
* saving the change.
@@ -108,7 +107,7 @@ private Map<Thread, Node> getOrCreateNodesMap() {
108107

109108
Map<Thread, Node> nodes = map.get(currentFixtureName);
110109
if (nodes == null) {
111-
nodes = Maps.newIdentityHashMap();
110+
nodes = new IdentityHashMap<>();
112111
}
113112
return nodes;
114113
}

oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Collections;
2525
import java.util.HashMap;
2626
import java.util.HashSet;
27+
import java.util.IdentityHashMap;
2728
import java.util.Iterator;
2829
import java.util.LinkedHashSet;
2930
import java.util.LinkedList;
@@ -39,7 +40,6 @@
3940
import java.util.stream.Stream;
4041
import java.util.stream.StreamSupport;
4142

42-
import org.apache.jackrabbit.guava.common.collect.Maps;
4343
import org.jetbrains.annotations.NotNull;
4444

4545
/**
@@ -377,7 +377,7 @@ public static <K> Set<K> newLinkedHashSet(final int capacity) {
377377
*/
378378
@NotNull
379379
public static <E> Set<E> newIdentityHashSet() {
380-
return Collections.newSetFromMap(Maps.newIdentityHashMap());
380+
return Collections.newSetFromMap(new IdentityHashMap<>());
381381
}
382382

383383
/**

oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.Calendar;
4242
import java.util.Collections;
4343
import java.util.HashSet;
44+
import java.util.IdentityHashMap;
4445
import java.util.List;
4546
import java.util.Map;
4647
import java.util.Set;
@@ -97,8 +98,6 @@
9798
import org.junit.Ignore;
9899
import org.junit.Test;
99100

100-
import org.apache.jackrabbit.guava.common.collect.Maps;
101-
102101
import ch.qos.logback.classic.Level;
103102
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.MISSING_NODE;
104103

@@ -521,7 +520,7 @@ public void run() {
521520
// OAK-1784
522521
@Test
523522
public void failOnConflict() throws Exception {
524-
final Map<Thread, Semaphore> locks = Maps.newIdentityHashMap();
523+
final Map<Thread, Semaphore> locks = new IdentityHashMap<>();
525524
NodeStore store = new MemoryNodeStore() {
526525
@NotNull
527526
@Override

oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitQueue.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static java.util.Objects.requireNonNull;
2121

2222
import java.util.HashSet;
23+
import java.util.IdentityHashMap;
2324
import java.util.Iterator;
2425
import java.util.Map;
2526
import java.util.Set;
@@ -31,8 +32,6 @@
3132
import java.util.concurrent.Semaphore;
3233
import java.util.concurrent.TimeUnit;
3334

34-
import org.apache.jackrabbit.guava.common.collect.Maps;
35-
3635
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
3736
import org.jetbrains.annotations.NotNull;
3837
import org.slf4j.Logger;
@@ -56,7 +55,7 @@ final class CommitQueue {
5655
/**
5756
* Map of currently suspended commits until a given Revision is visible.
5857
*/
59-
private final Map<Semaphore, SuspendedCommit> suspendedCommits = Maps.newIdentityHashMap();
58+
private final Map<Semaphore, SuspendedCommit> suspendedCommits = new IdentityHashMap<>();
6059

6160
private final RevisionContext context;
6261

oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCWithSplitTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020

2121
import java.io.IOException;
2222
import java.util.ArrayList;
23+
import java.util.IdentityHashMap;
2324
import java.util.List;
2425
import java.util.Map;
2526
import java.util.concurrent.Semaphore;
2627
import java.util.concurrent.atomic.AtomicReference;
2728

28-
import org.apache.jackrabbit.guava.common.collect.Maps;
29-
3029
import org.apache.jackrabbit.oak.api.CommitFailedException;
3130
import org.apache.jackrabbit.oak.plugins.document.util.TimingDocumentStoreWrapper;
3231
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
@@ -61,7 +60,7 @@ public class VersionGCWithSplitTest {
6160

6261
private Clock clock;
6362

64-
private Map<Thread, Semaphore> updateLocks = Maps.newIdentityHashMap();
63+
private Map<Thread, Semaphore> updateLocks = new IdentityHashMap<>();
6564

6665
private DocumentNodeStore store;
6766

0 commit comments

Comments
 (0)