Github user erikdw commented on a diff in the pull request: https://github.com/apache/storm/pull/746#discussion_r41366711 --- Diff: storm-core/src/jvm/backtype/storm/scheduler/Cluster.java --- @@ -438,6 +451,35 @@ public SupervisorDetails getSupervisorById(String nodeId) { return this.supervisors; } + /* + * Note: Make sure the proper conf was passed into the Cluster constructor before calling this function + * It tries to load the proper network topography detection plugin specified in the config. + */ + public Map<String, List<String>> getNetworkTopography() { + if (networkTopography == null) { + networkTopography = new HashMap<String, List<String>>(); + ArrayList<String> supervisorHostNames = new ArrayList<String>(); + for (SupervisorDetails s : supervisors.values()) { + supervisorHostNames.add(s.getHost()); + } + + String clazz = (String) conf.get(Config.STORM_NETWORK_TOPOGRAPHY_PLUGIN); + DNSToSwitchMapping topographyMapper = (DNSToSwitchMapping) Utils.newInstance(clazz); + + Map <String,String> resolvedSuperVisors = topographyMapper.resolve(supervisorHostNames); + for(String hostName: resolvedSuperVisors.keySet()) { --- End diff -- Please use consistent for/if/while styling. i.e., most of your new code is `for(`, but some (see 9 lines above) is `for (`. It *seems* like the storm project is more consistently using `for (`. This comment also applies to the `){` at the end of various lines. That should always be `) {` IMNSHO.
--- 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. ---