Izeren commented on code in PR #27642:
URL: https://github.com/apache/flink/pull/27642#discussion_r2839880710
##########
flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java:
##########
@@ -31,72 +38,108 @@ public String getString(String key, String defaultValue) {
}
/**
- * Searches for the property with the specified key in this property list.
If the key is not
- * found in this property list, the default property list, and its
defaults, recursively, are
- * then checked. The method returns the default value argument if the
property is not found.
+ * Returns the value associated with the given key as an {@code int}.
+ *
+ * <p>If the value is a {@link Number}, its {@code intValue()} is returned
directly. Otherwise,
+ * the value's string representation is parsed via {@link
Integer#parseInt(String)}.
*
* @param key the hashtable key.
* @param defaultValue a default value.
- * @return the value in this property list with the specified key value
parsed as an int.
+ * @return the value in this property list with the specified key value as
an int.
*/
public int getInteger(String key, int defaultValue) {
- String argument = getProperty(key, null);
- return argument == null ? defaultValue : Integer.parseInt(argument);
+ final Object value = get(key);
Review Comment:
As part of the FLIP, I will introduce additional configs, like `batch_size`
and my intention is to use it with `getInt`. I could include both changes in 1
PR, but as separate commits, but this change is rather a dependency that part
of the same "feature", so I have turned it into subtask on its own
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]