Skip to content

Commit

Permalink
Refactor listener to simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
smalyshev committed Sep 13, 2024
1 parent cf5e2ec commit 8a05bc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ public TransportClusterStatsAction(

@Override
protected void doExecute(Task task, ClusterStatsRequest request, ActionListener<ClusterStatsResponse> listener) {
if (doRemotes(request)) {
super.doExecute(task, request, new ActionListenerWithRemotes(task, request, listener));
} else {
super.doExecute(task, request, listener);
}
super.doExecute(task, request, new ActionListenerWithRemotes(task, request, listener));
}

@Override
Expand All @@ -160,6 +156,7 @@ protected void newResponseAsync(
);
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.MANAGEMENT);
assert task instanceof CancellableTask;
assert listener instanceof ActionListenerWithRemotes;

if (request.isRemoteStats()) {
newRemoteResponseAsync(responses, listener);
Expand All @@ -174,10 +171,7 @@ protected void newResponseAsync(
clusterService.threadPool().absoluteTimeInMillis()
);

SubscribableListener<Map<String, RemoteClusterStats>> remoteClusterStatsListener =
(listener instanceof ActionListenerWithRemotes listenerWithRemotes)
? listenerWithRemotes.getRemoteClusterStats()
: SubscribableListener.newSucceeded(null);
var remoteClusterStatsListener = ((ActionListenerWithRemotes) listener).getRemoteClusterStats();

final ListenableFuture<MappingStats> mappingStatsStep = new ListenableFuture<>();
final ListenableFuture<AnalysisStats> analysisStatsStep = new ListenableFuture<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String getName() {

@Override
public Set<String> supportedQueryParameters() {
return Set.of("include_remotes");
return Set.of("include_remotes", "nodeId");
}

@Override
Expand Down

0 comments on commit 8a05bc2

Please sign in to comment.