MAPREDUCE-3038. job history server not starting because conf() missing HsController (Jeffrey Naisbitt via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1172875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mahadev Konar 2011-09-19 22:51:46 +00:00
parent 8ae3cdeac7
commit e16f8a9fdf
2 changed files with 24 additions and 14 deletions

View File

@ -1357,6 +1357,9 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3042. Fixed default ResourceTracker address. (Chris Riccomini MAPREDUCE-3042. Fixed default ResourceTracker address. (Chris Riccomini
via acmurthy) via acmurthy)
MAPREDUCE-3038. job history server not starting because conf() missing
HsController (Jeffrey Naisbitt via mahadev)
Release 0.22.0 - Unreleased Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -25,6 +25,8 @@
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.lang.NoSuchMethodException;
import java.lang.SecurityException;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -88,23 +90,28 @@ synchronized Dest add(WebApp.HTTP httpMethod, String path,
private Dest addController(WebApp.HTTP httpMethod, String path, private Dest addController(WebApp.HTTP httpMethod, String path,
Class<? extends Controller> cls, Class<? extends Controller> cls,
String action, List<String> names) { String action, List<String> names) {
for (Method method : cls.getDeclaredMethods()) { try {
if (method.getName().equals(action) && // Look for the method in all public methods declared in the class
method.getParameterTypes().length == 0 && // or inherited by the class.
Modifier.isPublic(method.getModifiers())) { // Note: this does not distinguish methods with the same signature
// TODO: deal with parameters using the names // but different return types.
Dest dest = routes.get(path); // TODO: We may want to deal with methods that take parameters in the future
if (dest == null) { Method method = cls.getMethod(action, null);
method.setAccessible(true); // avoid any runtime checks Dest dest = routes.get(path);
dest = new Dest(path, method, cls, names, httpMethod); if (dest == null) {
routes.put(path, dest); method.setAccessible(true); // avoid any runtime checks
return dest; dest = new Dest(path, method, cls, names, httpMethod);
} routes.put(path, dest);
dest.methods.add(httpMethod);
return 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) { private void addDefaultView(Dest dest) {