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

    https://github.com/apache/storm/pull/921#discussion_r46719645
  
    --- Diff: storm-core/src/jvm/backtype/storm/scheduler/Cluster.java ---
    @@ -90,6 +92,23 @@ 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);
    +        Cluster copy = new Cluster(this.inimbus, this.supervisors, 
newAssignments, newConf);
    +        for (Map.Entry<String, String> entry : this.status.entrySet()) {
    +            copy.setStatus(entry.getKey(), entry.getValue());
    +        }
    --- End diff --
    
    will change


---
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