You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by ma...@apache.org on 2011/09/20 00:51:46 UTC
svn commit: r1172875 - in /hadoop/common/trunk/hadoop-mapreduce-project:
CHANGES.txt
hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
Author: mahadev
Date: Mon Sep 19 22:51:46 2011
New Revision: 1172875
URL: http://svn.apache.org/viewvc?rev=1172875&view=rev
Log:
MAPREDUCE-3038. job history server not starting because conf() missing HsController (Jeffrey Naisbitt via mahadev)
Modified:
hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
Modified: hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt?rev=1172875&r1=1172874&r2=1172875&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Mon Sep 19 22:51:46 2011
@@ -1357,6 +1357,9 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3042. Fixed default ResourceTracker address. (Chris Riccomini
via acmurthy)
+ MAPREDUCE-3038. job history server not starting because conf() missing
+ HsController (Jeffrey Naisbitt via mahadev)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java?rev=1172875&r1=1172874&r2=1172875&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/Router.java Mon Sep 19 22:51:46 2011
@@ -25,6 +25,8 @@ import com.google.common.collect.Maps;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.NoSuchMethodException;
+import java.lang.SecurityException;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
@@ -88,23 +90,28 @@ class Router {
private Dest addController(WebApp.HTTP httpMethod, String path,
Class<? extends Controller> cls,
String action, List<String> names) {
- for (Method method : cls.getDeclaredMethods()) {
- if (method.getName().equals(action) &&
- method.getParameterTypes().length == 0 &&
- Modifier.isPublic(method.getModifiers())) {
- // TODO: deal with parameters using the names
- Dest dest = routes.get(path);
- if (dest == null) {
- method.setAccessible(true); // avoid any runtime checks
- dest = new Dest(path, method, cls, names, httpMethod);
- routes.put(path, dest);
- return dest;
- }
- dest.methods.add(httpMethod);
+ try {
+ // Look for the method in all public methods declared in the class
+ // or inherited by the class.
+ // Note: this does not distinguish methods with the same signature
+ // but different return types.
+ // TODO: We may want to deal with methods that take parameters in the future
+ Method method = cls.getMethod(action, null);
+ Dest dest = routes.get(path);
+ if (dest == null) {
+ method.setAccessible(true); // avoid any runtime checks
+ dest = new Dest(path, method, cls, names, httpMethod);
+ routes.put(path, dest);
return dest;
}
+ dest.methods.add(httpMethod);
+ return dest;
+ } catch (NoSuchMethodException nsme) {
+ throw new WebAppException(action + "() not found in " + cls);
+ } catch (SecurityException se) {
+ throw new WebAppException("Security exception thrown for " + action +
+ "() in " + cls);
}
- throw new WebAppException(action + "() not found in " + cls);
}
private void addDefaultView(Dest dest) {