diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java index eba6db3789bbe..31282d35a71e3 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportMountSearchableSnapshotAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.StepListener; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.support.ActionFilters; @@ -26,6 +25,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ListenableFuture; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.indices.ShardLimitValidator; import org.elasticsearch.indices.SystemIndices; @@ -185,9 +185,9 @@ protected void masterOperation( final Repository repository = repositoriesService.repository(repoName); SearchableSnapshots.getSearchableRepository(repository); // just check it's valid - final StepListener repositoryDataListener = new StepListener<>(); + final ListenableFuture repositoryDataListener = new ListenableFuture<>(); repository.getRepositoryData(repositoryDataListener); - repositoryDataListener.whenComplete(repoData -> { + repositoryDataListener.addListener(ActionListener.wrap(repoData -> { final Map indexIds = repoData.getIndices(); if (indexIds.containsKey(indexName) == false) { throw new IndexNotFoundException("index [" + indexName + "] not found in repository [" + repoName + "]"); @@ -280,6 +280,6 @@ protected void masterOperation( .snapshotUuid(snapshotId.getUUID()), listener ); - }, listener::onFailure); + }, listener::onFailure), threadPool.generic(), null); } }