Repository: hadoop Updated Branches: refs/heads/branch-3.0 1c96e0d69 -> 3e70fd9af
YARN-7434. Router getApps REST invocation fails with multiple RMs. Contributed by Inigo Goiri. (cherry picked from commit 6e2259264ad9525eeec2a14055d53236711659d7) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3e70fd9a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3e70fd9a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3e70fd9a Branch: refs/heads/branch-3.0 Commit: 3e70fd9af06b007cadddc98d2806941716de4c86 Parents: 1c96e0d Author: Inigo Goiri <inigo...@apache.org> Authored: Thu Nov 2 21:29:34 2017 -0700 Committer: Inigo Goiri <inigo...@apache.org> Committed: Thu Nov 2 21:30:20 2017 -0700 ---------------------------------------------------------------------- .../webapp/FederationInterceptorREST.java | 26 +++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/3e70fd9a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java index 6e67634..626d794 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java @@ -682,10 +682,10 @@ public class FederationInterceptorREST extends AbstractRESTRequestInterceptor { CompletionService<AppsInfo> compSvc = new ExecutorCompletionService<>(this.threadpool); + // HttpServletRequest does not work with ExecutorCompletionService. + // Create a duplicate hsr. + final HttpServletRequest hsrCopy = clone(hsr); for (final SubClusterInfo info : subClustersActive.values()) { - // HttpServletRequest does not work with ExecutorCompletionService. - // Create a duplicate hsr. - final HttpServletRequest hsrCopy = clone(hsr); compSvc.submit(new Callable<AppsInfo>() { @Override public AppsInfo call() { @@ -744,24 +744,32 @@ public class FederationInterceptorREST extends AbstractRESTRequestInterceptor { if (hsr == null) { return null; } + @SuppressWarnings("unchecked") + final Map<String, String[]> parameterMap = + (Map<String, String[]>) hsr.getParameterMap(); + final String pathInfo = hsr.getPathInfo(); + final String user = hsr.getRemoteUser(); + final Principal principal = hsr.getUserPrincipal(); + final String mediaType = + RouterWebServiceUtil.getMediaTypeFromHttpServletRequest( + hsr, AppsInfo.class); return new HttpServletRequestWrapper(hsr) { public Map<String, String[]> getParameterMap() { - return hsr.getParameterMap(); + return parameterMap; } public String getPathInfo() { - return hsr.getPathInfo(); + return pathInfo; } public String getRemoteUser() { - return hsr.getRemoteUser(); + return user; } public Principal getUserPrincipal() { - return hsr.getUserPrincipal(); + return principal; } public String getHeader(String value) { // we override only Accept if (value.equals(HttpHeaders.ACCEPT)) { - return RouterWebServiceUtil.getMediaTypeFromHttpServletRequest( - hsr, AppsInfo.class); + return mediaType; } return null; } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org