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

Remove Redundant ConcurrentHashMapLong #76172

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 @@ -46,17 +46,6 @@ public static <K, V> ConcurrentMap<K, V> newConcurrentMap() {
return new ConcurrentHashMap<>();
}

/**
* Creates a new CHM with an aggressive concurrency level, aimed at highly updateable long living maps.
*/
public static <V> ConcurrentMapLong<V> newConcurrentMapLongWithAggressiveConcurrency() {
return new ConcurrentHashMapLong<>(ConcurrentCollections.<Long, V>newConcurrentMapWithAggressiveConcurrency());
}

public static <V> ConcurrentMapLong<V> newConcurrentMapLong() {
return new ConcurrentHashMapLong<>(ConcurrentCollections.<Long, V>newConcurrentMap());
}

public static <V> Set<V> newConcurrentSet() {
return Collections.newSetFromMap(ConcurrentCollections.<V, Boolean>newConcurrentMap());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexNotFoundException;
Expand Down Expand Up @@ -222,7 +221,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv

private final AtomicLong idGenerator = new AtomicLong();

private final ConcurrentMapLong<ReaderContext> activeReaders = ConcurrentCollections.newConcurrentMapLongWithAggressiveConcurrency();
private final Map<Long, ReaderContext> activeReaders = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();

private final MultiBucketConsumerService multiBucketConsumerService;

Expand Down
6 changes: 2 additions & 4 deletions server/src/main/java/org/elasticsearch/tasks/TaskManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TaskTransportChannel;
Expand Down Expand Up @@ -78,10 +77,9 @@ public class TaskManager implements ClusterStateApplier {
private final List<String> taskHeaders;
private final ThreadPool threadPool;

private final ConcurrentMapLong<Task> tasks = ConcurrentCollections.newConcurrentMapLongWithAggressiveConcurrency();
private final Map<Long, Task> tasks = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();

private final ConcurrentMapLong<CancellableTaskHolder> cancellableTasks = ConcurrentCollections
.newConcurrentMapLongWithAggressiveConcurrency();
private final Map<Long, CancellableTaskHolder> cancellableTasks = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency();

private final AtomicLong taskIdGenerator = new AtomicLong();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.common.util.Maps;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -165,8 +164,8 @@ public String action() {
* This class is a registry that allows
*/
final class ResponseHandlers {
private final ConcurrentMapLong<ResponseContext<? extends TransportResponse>> handlers = ConcurrentCollections
.newConcurrentMapLongWithAggressiveConcurrency();
private final Map<Long, ResponseContext<? extends TransportResponse>> handlers = ConcurrentCollections
.newConcurrentMapWithAggressiveConcurrency();
private final AtomicLong requestIdGenerator = new AtomicLong();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.aggregations.AggregationBuilders;
Expand Down Expand Up @@ -574,7 +573,7 @@ public void testRealtime_multipleStopCalls() throws Exception {
final String datafeedId = jobId + "-datafeed";
startRealtime(jobId);

ConcurrentMapLong<AssertionError> exceptions = ConcurrentCollections.newConcurrentMapLong();
Map<Long, AssertionError> exceptions = ConcurrentCollections.newConcurrentMap();

// It's practically impossible to assert that a stop request has waited
// for a concurrently executing request to finish before returning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ public void testDelete_multipleRequest() throws Exception {
String jobId = "delete-job-multiple-times";
createFarequoteJob(jobId);

ConcurrentMapLong<Response> responses = ConcurrentCollections.newConcurrentMapLong();
ConcurrentMapLong<ResponseException> responseExceptions = ConcurrentCollections.newConcurrentMapLong();
Map<Long, Response> responses = ConcurrentCollections.newConcurrentMap();
Map<Long, ResponseException> responseExceptions = ConcurrentCollections.newConcurrentMap();
AtomicReference<IOException> ioe = new AtomicReference<>();
AtomicInteger recreationGuard = new AtomicInteger(0);
AtomicReference<Response> recreationResponse = new AtomicReference<>();
Expand Down