Repository: flink Updated Branches: refs/heads/master c8f5745f2 -> c5a9a3eb0
[FLINK-4302] [metrics] Add documentation to MetricConfig Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c5a9a3eb Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c5a9a3eb Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c5a9a3eb Branch: refs/heads/master Commit: c5a9a3eb0061014fe59086505130596e924db7f9 Parents: c8f5745 Author: zentol <[email protected]> Authored: Wed Aug 10 16:23:54 2016 +0200 Committer: zentol <[email protected]> Committed: Wed Aug 17 14:01:50 2016 +0200 ---------------------------------------------------------------------- .../org/apache/flink/metrics/MetricConfig.java | 53 ++++++++++++++++++++ .../flink/metrics/reporter/MetricReporter.java | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/c5a9a3eb/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java ---------------------------------------------------------------------- diff --git a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java index a611ae8..4a2e616 100644 --- a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java +++ b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java @@ -19,12 +19,25 @@ package org.apache.flink.metrics; import java.util.Properties; +/** + * A properties class with added utility method to extract primitives. + */ public class MetricConfig extends Properties { public String getString(String key, String defaultValue) { return getProperty(key, 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. + * + * @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. + */ public int getInteger(String key, int defaultValue) { String argument = getProperty(key, null); return argument == null @@ -32,6 +45,16 @@ public class MetricConfig extends Properties { : Integer.parseInt(argument); } + /** + * 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. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a long. + */ public long getLong(String key, long defaultValue) { String argument = getProperty(key, null); return argument == null @@ -39,6 +62,16 @@ public class MetricConfig extends Properties { : Long.parseLong(argument); } + /** + * 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. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a float. + */ public float getFloat(String key, float defaultValue) { String argument = getProperty(key, null); return argument == null @@ -46,6 +79,16 @@ public class MetricConfig extends Properties { : Float.parseFloat(argument); } + /** + * 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. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a double. + */ public double getDouble(String key, double defaultValue) { String argument = getProperty(key, null); return argument == null @@ -53,6 +96,16 @@ public class MetricConfig extends Properties { : Double.parseDouble(argument); } + /** + * 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. + * + * @param key the hashtable key. + * @param defaultValue a default value. + * @return the value in this property list with the specified key value parsed as a boolean. + */ public boolean getBoolean(String key, boolean defaultValue) { String argument = getProperty(key, null); return argument == null http://git-wip-us.apache.org/repos/asf/flink/blob/c5a9a3eb/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java ---------------------------------------------------------------------- diff --git a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java index bd13be7..ee92a10 100644 --- a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java +++ b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/reporter/MetricReporter.java @@ -40,7 +40,7 @@ public interface MetricReporter { * * <p>This method is always called first on a newly instantiated reporter. * - * @param config The configuration with all parameters. + * @param config A properties object that contains all parameters set for this reporter. */ void open(MetricConfig config);
