pkuwm commented on a change in pull request #1129:
URL: https://github.com/apache/helix/pull/1129#discussion_r462538916
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/rebalancer/topology/Topology.java
##########
@@ -289,6 +310,29 @@ private boolean isInstanceEnabled(ClusterConfig
clusterConfig, String instanceNa
return instanceTopologyMap;
}
+ /**
+ * This function returns a LinkedHashMap<String, String> object representing
+ * the topology path for an instance.
+ * LinkedHashMap is used here since the order of the path needs to be
preserved
+ * when creating the topology tree.
+ *
+ * @param clusterConfig clusterConfig of the given cluster.
+ * @param instanceName name of the instance.
+ * @param instanceConfig instanceConfig to be checked.
+ * @param earlyQuitForFaultZone Set to true if we only need the path till
faultZone.
+ *
+ * @return an LinkedHashMap object representing the topology path for the
input instance.
+ */
+ public static LinkedHashMap<String, String> computeInstanceTopologyMap(
+ ClusterConfig clusterConfig, String instanceName, InstanceConfig
instanceConfig,
+ boolean earlyQuitForFaultZone) throws IllegalArgumentException {
Review comment:
I suggest not throwing `IllegalArgumentException` in the method
signature because: an unchecked exception does not need to declare in the
method signature. `throws` keyword is used for handling checked exception.
There are some good articles about this, eg:
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#throwstag
I suggest put this info in javadoc like this
```
@throws IllegalArugmentException when it is thrown
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]