qqu0127 commented on code in PR #2102:
URL: https://github.com/apache/helix/pull/2102#discussion_r876116083
##########
helix-core/src/main/java/org/apache/helix/task/assigner/ThreadCountBasedTaskAssigner.java:
##########
@@ -74,19 +75,16 @@ public Map<String, TaskAssignResult>
assignTasks(Iterable<AssignableInstance> as
public Map<String, TaskAssignResult> assignTasks(
AssignableInstanceManager assignableInstanceManager, Collection<String>
instances,
Iterable<TaskConfig> tasks, String quotaType) {
- Iterable<AssignableInstance> assignableInstances = new HashSet<>();
+ Set<AssignableInstance> assignableInstances = new HashSet<>();
// Only add the AssignableInstances that are also in instances
for (String instance : instances) {
- ((HashSet<AssignableInstance>) assignableInstances)
- .add(assignableInstanceManager.getAssignableInstance(instance));
+
assignableInstances.add(assignableInstanceManager.getAssignableInstance(instance));
}
if (tasks == null || !tasks.iterator().hasNext()) {
- logger.warn("No task to assign!");
return Collections.emptyMap();
}
- if (assignableInstances == null ||
!assignableInstances.iterator().hasNext()) {
- logger.warn("No instance to assign!");
+ if (assignableInstances.isEmpty()) {
Review Comment:
It's never null, see `Set<AssignableInstance> assignableInstances = new
HashSet<>();` in line 78
--
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]