HADOOP-17329. mvn site commands fails due to MetricsSystemImpl changes. Contributed by Xiaoqiao He.

(cherry picked from commit f17e067d52)
This commit is contained in:
Sunil G 2020-10-29 07:19:36 +05:30
parent 576f99ba40
commit 14a4606a9a
1 changed files with 15 additions and 14 deletions

View File

@ -1,11 +1,12 @@
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java
index a277abd..ed7c709 100644 index a277abd6e13..1d131d5db6e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsSystem.java
@@ -43,18 +43,6 @@ @@ -42,18 +42,6 @@
@InterfaceAudience.Private
public abstract MetricsSystem init(String prefix); public abstract MetricsSystem init(String prefix);
/** - /**
- * Register a metrics source - * Register a metrics source
- * @param <T> the actual type of the source object - * @param <T> the actual type of the source object
- * @param source object to register - * @param source object to register
@ -17,15 +18,11 @@ index a277abd..ed7c709 100644
- */ - */
- public abstract <T> T register(String name, String desc, T source); - public abstract <T> T register(String name, String desc, T source);
- -
- /** /**
* Unregister a metrics source * Unregister a metrics source
* @param name of the source. This is the name you use to call register() * @param name of the source. This is the name you use to call register()
*/ @@ -79,16 +67,16 @@
@@ -77,18 +65,19 @@
*/
@InterfaceAudience.Private
public abstract MetricsSource getSource(String name); public abstract MetricsSource getSource(String name);
+
/** /**
- * Register a metrics sink - * Register a metrics sink
@ -50,10 +47,10 @@ index a277abd..ed7c709 100644
/** /**
* Register a callback interface for JMX events * Register a callback interface for JMX events
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
index 6986edb..eeea81f 100644 index a6edf08e5a7..5b87be1ec67 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
@@ -270,27 +270,6 @@ void registerSource(String name, String desc, MetricsSource source) { @@ -269,31 +269,6 @@ void registerSource(String name, String desc, MetricsSource source) {
LOG.debug("Registered source "+ name); LOG.debug("Registered source "+ name);
} }
@ -61,7 +58,11 @@ index 6986edb..eeea81f 100644
- T register(final String name, final String description, final T sink) { - T register(final String name, final String description, final T sink) {
- LOG.debug(name +", "+ description); - LOG.debug(name +", "+ description);
- if (allSinks.containsKey(name)) { - if (allSinks.containsKey(name)) {
- LOG.warn("Sink "+ name +" already exists!"); - if(sinks.get(name) == null) {
- registerSink(name, description, sink);
- } else {
- LOG.warn("Sink "+ name +" already exists!");
- }
- return sink; - return sink;
- } - }
- allSinks.put(name, sink); - allSinks.put(name, sink);
@ -82,10 +83,10 @@ index 6986edb..eeea81f 100644
checkNotNull(config, "config"); checkNotNull(config, "config");
MetricsConfig conf = sinkConfigs.get(name); MetricsConfig conf = sinkConfigs.get(name);
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
index c19d238..f8412f1 100644 index 7bc772f062a..f012c877d18 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
@@ -130,8 +130,8 @@ public void testTagsForPrefix() throws Exception { @@ -139,8 +139,8 @@ public void testTagsForPrefix() throws Exception {
GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31); GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);
// register the sinks // register the sinks