Skip to content

Commit

Permalink
Core: use Java's built-in ConcurrentHashMap
Browse files Browse the repository at this point in the history
It's risky to have our own snapshot of Java 8's ConcurrentHashMap:
unless we keep the sources in sync over time (and OpenJDK's version
had already diverged), then we won't get bug/performance fixes.  Users
can choose to upgrade to Java 8 to see the improvements of CHM.

Closes #7392

Closes #7296
  • Loading branch information
mikemccand committed Aug 26, 2014
1 parent f2aa4a3 commit 075bd66
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12,309 deletions.
6,312 changes: 0 additions & 6,312 deletions src/main/java/jsr166e/ConcurrentHashMapV8.java

This file was deleted.

753 changes: 0 additions & 753 deletions src/main/java/jsr166e/CountedCompleter.java

This file was deleted.

3,345 changes: 0 additions & 3,345 deletions src/main/java/jsr166e/ForkJoinPool.java

This file was deleted.

1,557 changes: 0 additions & 1,557 deletions src/main/java/jsr166e/ForkJoinTask.java

This file was deleted.

125 changes: 0 additions & 125 deletions src/main/java/jsr166e/ForkJoinWorkerThread.java

This file was deleted.

199 changes: 0 additions & 199 deletions src/main/java/jsr166e/ThreadLocalRandom.java

This file was deleted.

Expand Up @@ -19,16 +19,17 @@

package org.elasticsearch.common.util.concurrent;

import com.google.common.collect.Sets;

import org.apache.lucene.util.Constants;

import java.util.Deque;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedTransferQueue;

import jsr166e.ConcurrentHashMapV8;
import com.google.common.collect.Sets;

/**
*
Expand All @@ -47,21 +48,11 @@ public abstract class ConcurrentCollections {
* Creates a new CHM with an aggressive concurrency level, aimed at high concurrent update rate long living maps.
*/
public static <K, V> ConcurrentMap<K, V> newConcurrentMapWithAggressiveConcurrency() {
if (Constants.JRE_IS_MINIMUM_JAVA8) {
// Just use JDK's impl when we are on Java8:
return new ConcurrentHashMap<>(16, 0.75f, aggressiveConcurrencyLevel);
} else {
return new ConcurrentHashMapV8<>(16, 0.75f, aggressiveConcurrencyLevel);
}
return new ConcurrentHashMap<>(16, 0.75f, aggressiveConcurrencyLevel);
}

public static <K, V> ConcurrentMap<K, V> newConcurrentMap() {
if (Constants.JRE_IS_MINIMUM_JAVA8) {
// Just use JDK's impl when we are on Java8:
return new ConcurrentHashMap<>();
} else {
return new ConcurrentHashMapV8<>();
}
return new ConcurrentHashMap<>();
}

/**
Expand Down

0 comments on commit 075bd66

Please sign in to comment.