Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2113#discussion_r120668059 --- Diff: storm-client/src/jvm/org/apache/storm/scheduler/SchedulerAssignmentImpl.java --- @@ -19,36 +19,82 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -//TODO: improve this by maintaining slot -> executors as well for more efficient operations +import org.apache.storm.generated.WorkerResources; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class SchedulerAssignmentImpl implements SchedulerAssignment { + private static final Logger LOG = LoggerFactory.getLogger(SchedulerAssignmentImpl.class); + /** * topology-id this assignment is for. */ - String topologyId; + private final String topologyId; + /** * assignment detail, a mapping from executor to <code>WorkerSlot</code> */ - Map<ExecutorDetails, WorkerSlot> executorToSlot; - - public SchedulerAssignmentImpl(String topologyId, Map<ExecutorDetails, WorkerSlot> executorToSlots) { - this.topologyId = topologyId; - this.executorToSlot = new HashMap<>(0); - if (executorToSlots != null) { - this.executorToSlot.putAll(executorToSlots); + private final Map<ExecutorDetails, WorkerSlot> executorToSlot = new HashMap<>(); + private final Map<WorkerSlot, WorkerResources> resources = new HashMap<>(); + private final Map<String, Double> totalSharedOffHeap = new HashMap<>(); + + public SchedulerAssignmentImpl(String topologyId, Map<ExecutorDetails, WorkerSlot> executorToSlot, + Map<WorkerSlot, WorkerResources> resources, Map<String, Double> totalSharedOffHeap) { + this.topologyId = topologyId; + if (executorToSlot != null) { --- End diff -- Ok. I'm the opposite way, I prefer avoiding null checks. But this is fine :)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---