HADOOP-13428. Fixed hadoop-common build files to generate jdiff by working around a jdiff-bug. Contributed by Wangda Tan.
(cherry picked from commit 99603e9022
)
This commit is contained in:
parent
3e511f39c2
commit
a299146b6d
|
@ -0,0 +1,98 @@
|
|||
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
|
||||
--- 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
|
||||
@@ -43,18 +43,6 @@
|
||||
public abstract MetricsSystem init(String prefix);
|
||||
|
||||
/**
|
||||
- * Register a metrics source
|
||||
- * @param <T> the actual type of the source object
|
||||
- * @param source object to register
|
||||
- * @param name of the source. Must be unique or null (then extracted from
|
||||
- * the annotations of the source object.)
|
||||
- * @param desc the description of the source (or null. See above.)
|
||||
- * @return the source object
|
||||
- * @exception MetricsException
|
||||
- */
|
||||
- public abstract <T> T register(String name, String desc, T source);
|
||||
-
|
||||
- /**
|
||||
* Unregister a metrics source
|
||||
* @param name of the source. This is the name you use to call register()
|
||||
*/
|
||||
@@ -77,18 +65,19 @@
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
public abstract MetricsSource getSource(String name);
|
||||
+
|
||||
|
||||
/**
|
||||
- * Register a metrics sink
|
||||
- * @param <T> the type of the sink
|
||||
- * @param sink to register
|
||||
- * @param name of the sink. Must be unique.
|
||||
- * @param desc the description of the sink
|
||||
- * @return the sink
|
||||
+ * Register a metrics source
|
||||
+ * @param <T> the actual type of the source object
|
||||
+ * @param source object to register
|
||||
+ * @param name of the source. Must be unique or null (then extracted from
|
||||
+ * the annotations of the source object.)
|
||||
+ * @param desc the description of the source (or null. See above.)
|
||||
+ * @return the source object
|
||||
* @exception MetricsException
|
||||
*/
|
||||
- public abstract <T extends MetricsSink>
|
||||
- T register(String name, String desc, T sink);
|
||||
+ public abstract <T> T register(String name, String desc, T source);
|
||||
|
||||
/**
|
||||
* 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
|
||||
index 6986edb..eeea81f 100644
|
||||
--- 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
|
||||
@@ -270,27 +270,6 @@ void registerSource(String name, String desc, MetricsSource source) {
|
||||
LOG.debug("Registered source "+ name);
|
||||
}
|
||||
|
||||
- @Override public synchronized <T extends MetricsSink>
|
||||
- T register(final String name, final String description, final T sink) {
|
||||
- LOG.debug(name +", "+ description);
|
||||
- if (allSinks.containsKey(name)) {
|
||||
- LOG.warn("Sink "+ name +" already exists!");
|
||||
- return sink;
|
||||
- }
|
||||
- allSinks.put(name, sink);
|
||||
- if (config != null) {
|
||||
- registerSink(name, description, sink);
|
||||
- }
|
||||
- // We want to re-register the sink to pick up new config
|
||||
- // when the metrics system restarts.
|
||||
- register(name, new AbstractCallback() {
|
||||
- @Override public void postStart() {
|
||||
- register(name, description, sink);
|
||||
- }
|
||||
- });
|
||||
- return sink;
|
||||
- }
|
||||
-
|
||||
synchronized void registerSink(String name, String desc, MetricsSink sink) {
|
||||
checkNotNull(config, "config");
|
||||
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
|
||||
index c19d238..f8412f1 100644
|
||||
--- 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
|
||||
@@ -130,8 +130,8 @@ public void testTagsForPrefix() throws Exception {
|
||||
GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);
|
||||
|
||||
// register the sinks
|
||||
- ms.register("gsink30", "gsink30 desc", gsink30);
|
||||
- ms.register("gsink31", "gsink31 desc", gsink31);
|
||||
+ //ms.register("gsink30", "gsink30 desc", gsink30);
|
||||
+ //ms.register("gsink31", "gsink31 desc", gsink31);
|
||||
ms.publishMetricsNow(); // publish the metrics
|
||||
|
||||
ms.stop();
|
File diff suppressed because one or more lines are too long
|
@ -33,6 +33,7 @@
|
|||
<properties>
|
||||
<hadoop.component>common</hadoop.component>
|
||||
<is.hadoop.component>true</is.hadoop.component>
|
||||
<is.hadoop.common.component>true</is.hadoop.common.component>
|
||||
<wsce.config.dir>../etc/hadoop</wsce.config.dir>
|
||||
<wsce.config.file>wsce-site.xml</wsce.config.file>
|
||||
</properties>
|
||||
|
@ -493,6 +494,7 @@
|
|||
<exclude>src/test/resources/test.har/_masterindex</exclude>
|
||||
<exclude>src/test/resources/test.har/part-0</exclude>
|
||||
<exclude>src/test/resources/javakeystoreprovider.password</exclude>
|
||||
<exclude>dev-support/jdiff-workaround.patch</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<jdiff.stable.api>2.6.0</jdiff.stable.api>
|
||||
<jdiff.stable.api>2.7.2</jdiff.stable.api>
|
||||
<jdiff.stability>-unstable</jdiff.stability>
|
||||
<!-- Commented out for HADOOP-11776 -->
|
||||
<!-- Uncomment param name="${jdiff.compatibility}" in javadoc doclet if compatibility is not empty -->
|
||||
|
@ -239,6 +239,26 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
|
||||
<!-- Pre site -->
|
||||
<execution>
|
||||
<id>pre-site</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target if="is.hadoop.common.component">
|
||||
<!-- HADOOP-13428: This is for workaround issues of JDiff
|
||||
- https://sourceforge.net/p/javadiff/bugs/19/ -->
|
||||
<exec executable="patch" input="dev-support/jdiff-workaround.patch" dir="${basedir}">
|
||||
<arg value="-p3"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
|
||||
<execution>
|
||||
<id>site</id>
|
||||
<phase>prepare-package</phase>
|
||||
|
@ -247,7 +267,6 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<target if="is.hadoop.component">
|
||||
|
||||
<mkdir dir="${project.build.directory}/docs-src"/>
|
||||
|
||||
<!-- Docs -->
|
||||
|
@ -300,6 +319,25 @@
|
|||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- post site phase -->
|
||||
<execution>
|
||||
<id>post-site</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target if="is.hadoop.common.component">
|
||||
<!-- HADOOP-13428: Revert temporary patch-->
|
||||
<exec executable="patch" input="dev-support/jdiff-workaround.patch" dir="${basedir}">
|
||||
<arg value="-p3"/>
|
||||
<arg value="-R"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
Loading…
Reference in New Issue