Skip to content

Commit a10f8bb

Browse files
author
Nathan Marz
committed
cleanup data structures used in Cluster
1 parent 0c4cb5e commit a10f8bb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/jvm/backtype/storm/scheduler/Cluster.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public boolean needsScheduling(TopologyDetails topology) {
8484
* @return
8585
*/
8686
public Map<ExecutorDetails, String> getNeedsSchedulingExecutorToComponents(TopologyDetails topology) {
87-
Collection<ExecutorDetails> allExecutors = new ArrayList<ExecutorDetails>();
88-
allExecutors.addAll(topology.getExecutors());
87+
Collection<ExecutorDetails> allExecutors = new HashSet(topology.getExecutors());
8988

9089
SchedulerAssignment assignment = this.assignments.get(topology.getId());
9190
if (assignment != null) {
@@ -175,13 +174,12 @@ public List<WorkerSlot> getAvailableSlots(SupervisorDetails supervisor) {
175174
/**
176175
* get the unassigned executors of the topology.
177176
*/
178-
public List<ExecutorDetails> getUnassignedExecutors(TopologyDetails topology) {
177+
public Collection<ExecutorDetails> getUnassignedExecutors(TopologyDetails topology) {
179178
if (topology == null) {
180179
return new ArrayList<ExecutorDetails>(0);
181180
}
182181

183-
List<ExecutorDetails> ret = new ArrayList<ExecutorDetails>();
184-
ret.addAll(topology.getExecutors());
182+
Collection<ExecutorDetails> ret = new HashSet(topology.getExecutors());
185183

186184
SchedulerAssignment assignment = this.getAssignmentById(topology.getId());
187185
if (assignment != null) {

0 commit comments

Comments
 (0)