Skip to content

Commit 7efff3c

Browse files
committed
renamed some methods to avoid confusion
1 parent 33e3cfc commit 7efff3c

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

src/clj/backtype/storm/daemon/nimbus.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@
471471
{topology-id -> {executor [node port]}}"
472472
(map-val (fn [^SchedulerAssignment assignment]
473473
(->> assignment
474-
.getExecutorToSlots
474+
.getExecutorToSlot
475475
(#(into {} (for [[^ExecutorDetails executor ^WorkerSlot slot] %]
476476
{[(.getStartTask executor) (.getEndTask executor)]
477477
[(.getNodeId slot) (.getPort slot)]})))))

src/clj/backtype/storm/scheduler/EvenScheduler.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
(defn get-alive-assigned-node+port->executors [cluster topology-id]
2121
(let [existing-assignment (.getAssignmentById cluster topology-id)
2222
executor->slot (if existing-assignment
23-
(.getExecutorToSlots existing-assignment)
23+
(.getExecutorToSlot existing-assignment)
2424
{})
2525
executor->node+port (into {} (for [[^ExecutorDetails executor ^WorkerSlot slot] executor->slot
2626
:let [executor [(.getStartTask executor) (.getEndTask executor)]

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ public class Cluster {
2424
/**
2525
* a map from hostname to supervisor id.
2626
*/
27-
private Map<String, List<String>> hostToIds;
27+
private Map<String, List<String>> hostToId;
2828

2929
public Cluster(Map<String, SupervisorDetails> supervisors, Map<String, SchedulerAssignment> assignments){
3030
this.supervisors = new HashMap<String, SupervisorDetails>(supervisors.size());
3131
this.supervisors.putAll(supervisors);
3232
this.assignments = new HashMap<String, SchedulerAssignment>(assignments.size());
3333
this.assignments.putAll(assignments);
34-
this.hostToIds = new HashMap<String, List<String>>();
34+
this.hostToId = new HashMap<String, List<String>>();
3535
for (String nodeId : supervisors.keySet()) {
3636
SupervisorDetails supervisor = supervisors.get(nodeId);
3737
String host = supervisor.getHost();
3838
if (!this.supervisors.containsKey(host)) {
39-
this.hostToIds.put(host, new ArrayList<String>());
39+
this.hostToId.put(host, new ArrayList<String>());
4040
}
41-
this.hostToIds.get(host).add(nodeId);
41+
this.hostToId.get(host).add(nodeId);
4242
}
4343
}
4444

@@ -94,7 +94,7 @@ public Map<ExecutorDetails, String> getNeedsSchedulingExecutorToComponents(Topol
9494
allExecutors.removeAll(assignedExecutors);
9595
}
9696

97-
return topology.selectExecutorToComponents(allExecutors);
97+
return topology.selectExecutorToComponent(allExecutors);
9898
}
9999

100100
/**
@@ -130,7 +130,7 @@ public List<Integer> getUsedPorts(SupervisorDetails supervisor) {
130130
List<Integer> usedPorts = new ArrayList<Integer>();
131131

132132
for (SchedulerAssignment assignment : assignments.values()) {
133-
for (WorkerSlot slot : assignment.getExecutorToSlots().values()) {
133+
for (WorkerSlot slot : assignment.getExecutorToSlot().values()) {
134134
if (slot.getNodeId().equals(supervisor.getId())) {
135135
usedPorts.add(slot.getPort());
136136
}
@@ -208,7 +208,7 @@ public int getAssignedNumWorkers(TopologyDetails topology) {
208208
}
209209

210210
Set<WorkerSlot> slots = new HashSet<WorkerSlot>();
211-
slots.addAll(assignment.getExecutorToSlots().values());
211+
slots.addAll(assignment.getExecutorToSlot().values());
212212

213213
return slots.size();
214214
}
@@ -321,7 +321,7 @@ public SupervisorDetails getSupervisorById(String nodeId) {
321321
* @return the <code>SupervisorDetails</code> object.
322322
*/
323323
public List<SupervisorDetails> getSupervisorsByHost(String host) {
324-
List<String> nodeIds = this.hostToIds.get(host);
324+
List<String> nodeIds = this.hostToId.get(host);
325325
List<SupervisorDetails> ret = new ArrayList<SupervisorDetails>();
326326

327327
if (nodeIds != null) {

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public class SchedulerAssignment {
1515
/**
1616
* assignment detail, a mapping from executor to <code>WorkerSlot</code>
1717
*/
18-
Map<ExecutorDetails, WorkerSlot> executorToSlots;
18+
Map<ExecutorDetails, WorkerSlot> executorToSlot;
1919

2020
public SchedulerAssignment(String topologyId, Map<ExecutorDetails, WorkerSlot> executorToSlots) {
2121
this.topologyId = topologyId;
22-
this.executorToSlots = new HashMap<ExecutorDetails, WorkerSlot>(0);
22+
this.executorToSlot = new HashMap<ExecutorDetails, WorkerSlot>(0);
2323
if (executorToSlots != null) {
24-
this.executorToSlots.putAll(executorToSlots);
24+
this.executorToSlot.putAll(executorToSlots);
2525
}
2626
}
2727

@@ -32,7 +32,7 @@ public SchedulerAssignment(String topologyId, Map<ExecutorDetails, WorkerSlot> e
3232
*/
3333
public void assign(WorkerSlot slot, Collection<ExecutorDetails> executors) {
3434
for (ExecutorDetails executor : executors) {
35-
this.executorToSlots.put(executor, slot);
35+
this.executorToSlot.put(executor, slot);
3636
}
3737
}
3838

@@ -42,16 +42,16 @@ public void assign(WorkerSlot slot, Collection<ExecutorDetails> executors) {
4242
*/
4343
public void removeSlot(WorkerSlot slot) {
4444
List<ExecutorDetails> executors = new ArrayList<ExecutorDetails>();
45-
for (ExecutorDetails executor : this.executorToSlots.keySet()) {
46-
WorkerSlot ws = this.executorToSlots.get(executor);
45+
for (ExecutorDetails executor : this.executorToSlot.keySet()) {
46+
WorkerSlot ws = this.executorToSlot.get(executor);
4747
if (ws.equals(slot)) {
4848
executors.add(executor);
4949
}
5050
}
5151

5252
// remove
5353
for (ExecutorDetails executor : executors) {
54-
this.executorToSlots.remove(executor);
54+
this.executorToSlot.remove(executor);
5555
}
5656
}
5757

@@ -61,7 +61,7 @@ public void removeSlot(WorkerSlot slot) {
6161
* @return
6262
*/
6363
public boolean isSlotOccupied(WorkerSlot slot) {
64-
Collection<WorkerSlot> slots = this.executorToSlots.values();
64+
Collection<WorkerSlot> slots = this.executorToSlot.values();
6565
for (WorkerSlot slot1 : slots) {
6666
if (slot1.equals(slot)) {
6767
return true;
@@ -75,15 +75,15 @@ public String getTopologyId() {
7575
return this.topologyId;
7676
}
7777

78-
public Map<ExecutorDetails, WorkerSlot> getExecutorToSlots() {
79-
return this.executorToSlots;
78+
public Map<ExecutorDetails, WorkerSlot> getExecutorToSlot() {
79+
return this.executorToSlot;
8080
}
8181

8282
/**
8383
* Return the executors covered by this assignments
8484
* @return
8585
*/
8686
public Set<ExecutorDetails> getExecutors() {
87-
return this.executorToSlots.keySet();
87+
return this.executorToSlot.keySet();
8888
}
8989
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
public class Topologies {
88
Map<String, TopologyDetails> topologies;
9-
Map<String, String> nameToIds;
9+
Map<String, String> nameToId;
1010

1111
public Topologies(Map<String, TopologyDetails> topologies) {
1212
this.topologies = new HashMap<String, TopologyDetails>(topologies.size());
1313
this.topologies.putAll(topologies);
14-
this.nameToIds = new HashMap<String, String>(topologies.size());
14+
this.nameToId = new HashMap<String, String>(topologies.size());
1515

1616
for (String topologyId : topologies.keySet()) {
1717
TopologyDetails topology = topologies.get(topologyId);
18-
this.nameToIds.put(topology.getName(), topologyId);
18+
this.nameToId.put(topology.getName(), topologyId);
1919
}
2020
}
2121

@@ -24,7 +24,7 @@ public TopologyDetails getById(String topologyId) {
2424
}
2525

2626
public TopologyDetails getByName(String topologyName) {
27-
String topologyId = this.nameToIds.get(topologyName);
27+
String topologyId = this.nameToId.get(topologyName);
2828

2929
if (topologyId == null) {
3030
return null;

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TopologyDetails {
1212
String topologyId;
1313
Map topologyConf;
1414
StormTopology topology;
15-
Map<ExecutorDetails, String> executorToComponents;
15+
Map<ExecutorDetails, String> executorToComponent;
1616

1717
public TopologyDetails(String topologyId, Map topologyConf, StormTopology topology) {
1818
this.topologyId = topologyId;
@@ -24,9 +24,9 @@ public TopologyDetails(String topologyId, Map topologyConf, StormTopology topolo
2424
this.topologyId = topologyId;
2525
this.topologyConf = topologyConf;
2626
this.topology = topology;
27-
this.executorToComponents = new HashMap<ExecutorDetails, String>(0);
27+
this.executorToComponent = new HashMap<ExecutorDetails, String>(0);
2828
if (executorToComponents != null) {
29-
this.executorToComponents.putAll(executorToComponents);
29+
this.executorToComponent.putAll(executorToComponents);
3030
}
3131
}
3232

@@ -46,14 +46,14 @@ public StormTopology getTopology() {
4646
return topology;
4747
}
4848

49-
public Map<ExecutorDetails, String> getTaskToComponents() {
50-
return this.executorToComponents;
49+
public Map<ExecutorDetails, String> getExecutorToComponent() {
50+
return this.executorToComponent;
5151
}
5252

53-
public Map<ExecutorDetails, String> selectExecutorToComponents(Collection<ExecutorDetails> executors) {
53+
public Map<ExecutorDetails, String> selectExecutorToComponent(Collection<ExecutorDetails> executors) {
5454
Map<ExecutorDetails, String> ret = new HashMap<ExecutorDetails, String>(executors.size());
5555
for (ExecutorDetails executor : executors) {
56-
String compId = this.executorToComponents.get(executor);
56+
String compId = this.executorToComponent.get(executor);
5757
if (compId != null) {
5858
ret.put(executor, compId);
5959
}
@@ -63,6 +63,6 @@ public Map<ExecutorDetails, String> selectExecutorToComponents(Collection<Execut
6363
}
6464

6565
public Collection<ExecutorDetails> getExecutors() {
66-
return this.executorToComponents.keySet();
66+
return this.executorToComponent.keySet();
6767
}
6868
}

0 commit comments

Comments
 (0)