srdo commented on a change in pull request #3096: STORM-3480 Implement One
Worker Per Executor RAS Option
URL: https://github.com/apache/storm/pull/3096#discussion_r310343947
##########
File path: storm-server/src/main/java/org/apache/storm/scheduler/Cluster.java
##########
@@ -56,6 +56,7 @@
private static final Logger LOG = LoggerFactory.getLogger(Cluster.class);
private static final Function<String, Set<WorkerSlot>> MAKE_SET = (x) ->
new HashSet<>();
private static final Function<String, Map<WorkerSlot,
NormalizedResourceRequest>> MAKE_MAP = (x) -> new HashMap<>();
+ private static final Function<String, Map<String, Double>>
MAKE_MAP_STRING_DOUBLE = (x) -> new HashMap<>();
Review comment:
I think it would be better to make a "real" function for this, so we can
parameterize it with generic params. We can then replace this and MAKE_MAP with
the generic version.
```
private static <K, V> Map<K, V> makeMap(String key) {
return new HashMap<>();
}
```
and at the call site
```
nodeToScheduledResourcesCache.computeIfAbsent(nodeId, Cluster::makeMap)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services