KYLIN-1014 add reference URL and support newer yarn version
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/2533fe5d Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/2533fe5d Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/2533fe5d Branch: refs/heads/1.x-HBase1.1.3 Commit: 2533fe5d3a17dd68850a2d15bd6bcb95d3b717f2 Parents: 9d7c42b Author: shaofengshi <shaofeng...@apache.org> Authored: Mon Dec 28 11:23:11 2015 +0800 Committer: shaofengshi <shaofeng...@apache.org> Committed: Mon Dec 28 11:23:44 2015 +0800 ---------------------------------------------------------------------- .../kylin/job/tools/HadoopStatusGetter.java | 30 ++++++++++++++++---- server/pom.xml | 5 +++- 2 files changed, 29 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/2533fe5d/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java ---------------------------------------------------------------------- diff --git a/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java b/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java index 8230d48..9035ad4 100644 --- a/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java +++ b/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java @@ -140,6 +140,8 @@ public class HadoopStatusGetter { private static String DEFAULT_KRB5_CONFIG_LOCATION = "/etc/krb5.conf"; private String getHttpResponseWithKerberosAuth(String url) throws IOException { + + // referred from https://stackoverflow.com/questions/24633380/how-do-i-authenticate-with-spnego-kerberos-and-apaches-httpclient String krb5ConfigPath = System.getProperty("java.security.krb5.conf"); if (krb5ConfigPath == null) { krb5ConfigPath = DEFAULT_KRB5_CONFIG_LOCATION; @@ -184,12 +186,28 @@ public class HadoopStatusGetter { httpget.addHeader("accept", "application/json"); CloseableHttpResponse response = client.execute(httpget,context); String redirect = null; - org.apache.http.Header h = response.getFirstHeader("Refresh"); + org.apache.http.Header h = response.getFirstHeader("Location"); if (h != null) { - String s = h.getValue(); - int cut = s.indexOf("url="); - if (cut >= 0) { - redirect = s.substring(cut + 4); + redirect = h.getValue(); + if (isValidURL(redirect) == false) { + log.info("Get invalid redirect url, skip it: " + redirect); + Thread.sleep(1000l); + continue; + } + } else { + h = response.getFirstHeader("Refresh"); + if (h != null) { + String s = h.getValue(); + int cut = s.indexOf("url="); + if (cut >= 0) { + redirect = s.substring(cut + 4); + + if (isValidURL(redirect) == false) { + log.info("Get invalid redirect url, skip it: " + redirect); + Thread.sleep(1000l); + continue; + } + } } } @@ -200,6 +218,8 @@ public class HadoopStatusGetter { url = redirect; log.debug("Job " + mrJobId + " check redirect url " + url + ".\n"); } + } catch (InterruptedException e) { + log.error(e.getMessage()); } finally { httpget.releaseConnection(); } http://git-wip-us.apache.org/repos/asf/kylin/blob/2533fe5d/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index ee34cc6..d41fc07 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -176,7 +176,10 @@ <artifactId>spring-test</artifactId> <version>${spring.framework.version}</version> </dependency> - + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </dependency> <!-- Spring Security --> <dependency> <groupId>org.springframework.security</groupId>