Github user d2r commented on a diff in the pull request:

    https://github.com/apache/storm/pull/921#discussion_r47692809
  
    --- Diff: storm-core/src/jvm/backtype/storm/scheduler/Cluster.java ---
    @@ -90,6 +92,21 @@ public Cluster(INimbus nimbus, Map<String, 
SupervisorDetails> supervisors, Map<S
             }
             this.conf = storm_conf;
         }
    +
    +    /**
    +     * Get a copy of this cluster object
    +     */
    +    public Cluster getCopy() {
    +        HashMap<String, SchedulerAssignmentImpl> newAssignments = new 
HashMap<String, SchedulerAssignmentImpl>();
    +        for (Map.Entry<String, SchedulerAssignmentImpl> entry : 
this.assignments.entrySet()) {
    +            newAssignments.put(entry.getKey(), new 
SchedulerAssignmentImpl(entry.getValue().getTopologyId(), 
entry.getValue().getExecutorToSlot()));
    +        }
    +        Map newConf = new HashMap<String, Object>();
    +        newConf.putAll(this.conf);
    --- End diff --
    
    I have seen `this.` used many times throughout a java class, and I think it 
adds clarity.
    
    If we remove uses of `this`, I would prefer using some notation for private 
members, like an underscore `_conf` as in other classes. Whatever we do, it 
would be good to be consistent within the class at least.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to