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 all blocking on Listenable*Future #94411

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,6 +24,7 @@
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.aggregations.bucket.adjacency.AdjacencyMatrixAggregationBuilder;
import org.elasticsearch.aggregations.bucket.adjacency.ParsedAdjacencyMatrix;
import org.elasticsearch.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder;
Expand Down Expand Up @@ -843,7 +844,9 @@ private Response performClientRequest(Request request) throws IOException {

Optional<String> versionValidation;
try {
versionValidation = getVersionValidationFuture().get();
final var future = new PlainActionFuture<Optional<String>>();
getVersionValidationFuture().addListener(future);
versionValidation = future.get();
} catch (InterruptedException | ExecutionException e) {
// Unlikely to happen
throw new ElasticsearchException(e);
Expand Down
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.action.admin.cluster.node.tasks;

import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskResponse;
import org.elasticsearch.action.support.ListenableActionFuture;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
Expand Down Expand Up @@ -59,7 +59,7 @@ public void testRetry() throws Exception {
});
barrier.await();
Task task;
ListenableActionFuture<TestTaskPlugin.NodesResponse> future = new ListenableActionFuture<>();
PlainActionFuture<TestTaskPlugin.NodesResponse> future = new PlainActionFuture<>();
try {
logger.info("start a task that will store its results");
TestTaskPlugin.NodesRequest req = new TestTaskPlugin.NodesRequest("foo");
Expand Down
Expand Up @@ -11,7 +11,7 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.ListenableActionFuture;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.time.DateFormatter;
Expand Down Expand Up @@ -485,9 +485,9 @@ private <R> R withMetrics(
int bucketBatchSize,
int docBatchSize,
TimeValue staleness,
BiConsumer<ListenableActionFuture<R>, TimeSeriesMetrics> handle
BiConsumer<PlainActionFuture<R>, TimeSeriesMetrics> handle
) {
ListenableActionFuture<R> result = new ListenableActionFuture<>();
PlainActionFuture<R> result = new PlainActionFuture<>();
new TimeSeriesMetricsService(client(), bucketBatchSize, docBatchSize, staleness).newMetrics(
new String[] { "tsdb" },
IndicesOptions.STRICT_EXPAND_OPEN,
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.ListenableActionFuture;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.http.HttpChannel;
Expand Down Expand Up @@ -74,7 +74,7 @@ public void testCompletedTasks() throws Exception {
TestHttpChannel channel = new TestHttpChannel();
totalSearches += numTasks;
for (int j = 0; j < numTasks; j++) {
ListenableActionFuture<SearchResponse> actionFuture = new ListenableActionFuture<>();
PlainActionFuture<SearchResponse> actionFuture = new PlainActionFuture<>();
RestCancellableNodeClient client = new RestCancellableNodeClient(testClient, channel);
threadPool.generic().submit(() -> client.execute(SearchAction.INSTANCE, new SearchRequest(), actionFuture));
futures.add(actionFuture);
Expand Down