kfaraz commented on code in PR #16227:
URL: https://github.com/apache/druid/pull/16227#discussion_r1555450155
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/client/IndexerWorkerManagerClient.java:
##########
@@ -65,21 +67,39 @@ public Map<String, TaskStatus> statuses(Set<String> taskIds)
@Override
public TaskLocation location(String workerId)
{
- final TaskStatus response = FutureUtils.getUnchecked(
- overlordClient.taskStatuses(ImmutableSet.of(workerId)),
- true
- ).get(workerId);
-
- if (response != null) {
- return response.getLocation();
- } else {
- return TaskLocation.unknown();
- }
+ return locationFetcher.getLocation(workerId);
}
@Override
public void close()
{
// Nothing to do. The OverlordServiceClient is closed by the JVM lifecycle.
}
+
+ private class TaskLocationFetcher
+ {
+ TaskLocation getLocation(String workerId)
+ {
+ final TaskStatus taskStatus = FutureUtils.getUnchecked(
+ overlordClient.taskStatuses(ImmutableSet.of(workerId)),
+ true
+ ).get(workerId);
+
+ if (taskStatus != null
+ && TaskLocation.unknown().equals(taskStatus.getLocation())) {
Review Comment:
Typo:
```suggestion
&& !TaskLocation.unknown().equals(taskStatus.getLocation())) {
```
##########
server/src/main/java/org/apache/druid/rpc/indexing/SpecificTaskServiceLocator.java:
##########
@@ -199,4 +208,20 @@ public void close()
}
}
}
+
+ private class TaskLocationFetcher
Review Comment:
Ideally, this wrapper should have the whole logic of calling the first API,
handling its future and then calling the second API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]