Last active
March 6, 2017 01:20
-
-
Save pkatseas/c0867a35d1f27c5dfbe8764b136c5b3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void populateComponentsByTagWithStormInternals( | |
Map<String, ArrayList<String>> componentsByTag, | |
Set<String> components | |
) { | |
// Storm uses some internal components, like __acker. | |
// These components are topology-agnostic and are therefore not accessible through a StormTopology object. | |
// While a bit hacky, this is a way to make sure that we schedule those components along with our topology ones: | |
// we treat these internal components as regular untagged components and add them to the componentsByTag map. | |
for (String componentID : components) { | |
if (componentID.startsWith("__")) { | |
if (componentsByTag.containsKey("untagged")) { | |
// If we've already seen untagged components, then just add the component to the existing ArrayList. | |
componentsByTag.get("untagged").add(componentID); | |
} else { | |
// If this is the first untagged component we see, then create a new ArrayList, | |
// add the current component, and populate the map's untagged entry with it. | |
ArrayList<String> newComponentList = new ArrayList<String>(); | |
newComponentList.add(componentID); | |
componentsByTag.put("untagged", newComponentList); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment