eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject incubator-eagle git commit: [MINOR] Move getHealthCheck from Application to ApplicationProvider
Date Tue, 15 Nov 2016 06:53:28 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master c1ce6ea4f -> 9795fbccb


[MINOR] Move getHealthCheck from Application to ApplicationProvider

Author: wujinhu <wujinhu920@126.com>

Closes #653 from wujinhu/HealthCheck.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/9795fbcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/9795fbcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/9795fbcc

Branch: refs/heads/master
Commit: 9795fbccba96a8b6b336398115b8e325303b0c89
Parents: c1ce6ea
Author: wujinhu <wujinhu920@126.com>
Authored: Tue Nov 15 14:53:14 2016 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Tue Nov 15 14:53:14 2016 +0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/eagle/app/Application.java  | 10 ----------
 .../service/impl/ApplicationHealthCheckServiceImpl.java  |  2 +-
 .../org/apache/eagle/app/spi/ApplicationProvider.java    | 11 +++++++++++
 .../eagle/jpm/mr/history/MRHistoryJobApplication.java    |  5 -----
 .../mr/history/MRHistoryJobApplicationHealthCheck.java   |  2 ++
 .../jpm/mr/history/MRHistoryJobApplicationProvider.java  |  7 +++++++
 6 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
index 9a2ea37..d76e468 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/Application.java
@@ -16,7 +16,6 @@
  */
 package org.apache.eagle.app;
 
-import com.codahale.metrics.health.HealthCheck;
 import org.apache.eagle.app.environment.Environment;
 import com.typesafe.config.Config;
 
@@ -55,13 +54,4 @@ public interface Application<
     Class<? extends E> getEnvironmentType();
 
     boolean isExecutable();
-
-    default HealthCheck getAppHealthCheck(Config config) {
-        return new HealthCheck() {
-            @Override
-            protected Result check() throws Exception {
-                return Result.healthy();
-            }
-        };
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
index bf28e93..eae7d1a 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
@@ -63,7 +63,7 @@ public class ApplicationHealthCheckServiceImpl implements ApplicationHealthCheck
             return;
         }
         ApplicationProvider<?> appProvider = applicationProviderService.getApplicationProviderByType(appEntity.getDescriptor().getType());
-        HealthCheck applicationHealthCheck = appProvider.getApplication().getAppHealthCheck(
+        HealthCheck applicationHealthCheck = appProvider.getAppHealthCheck(
                 ConfigFactory.parseMap(appEntity.getConfiguration())
                         .withFallback(config)
                         .withFallback(ConfigFactory.parseMap(appEntity.getContext()))

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
index bc70373..143e026 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
@@ -17,6 +17,8 @@
 
 package org.apache.eagle.app.spi;
 
+import com.codahale.metrics.health.HealthCheck;
+import com.typesafe.config.Config;
 import org.apache.eagle.app.Application;
 import org.apache.eagle.app.service.ApplicationListener;
 import org.apache.eagle.common.module.ModuleRegistry;
@@ -69,4 +71,13 @@ public interface ApplicationProvider<T extends Application> {
      * Extend application modules like Web Resource, Metadata Store, etc.
      */
     void register(ModuleRegistry registry);
+
+    default HealthCheck getAppHealthCheck(Config config) {
+        return new HealthCheck() {
+            @Override
+            protected Result check() throws Exception {
+                return Result.healthy();
+            }
+        };
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
index 2b4ffee..907ccdb 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplication.java
@@ -77,9 +77,4 @@ public class MRHistoryJobApplication extends StormApplication {
 
         return topologyBuilder.createTopology();
     }
-
-    @Override
-    public HealthCheck getAppHealthCheck(Config config) {
-        return new MRHistoryJobApplicationHealthCheck(config);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationHealthCheck.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationHealthCheck.java
b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationHealthCheck.java
index 91cbbd7..dcbcaf7 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationHealthCheck.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationHealthCheck.java
@@ -50,6 +50,8 @@ public class MRHistoryJobApplicationHealthCheck extends HealthCheck {
                     eagleServiceConfig.username,
                     eagleServiceConfig.password);
 
+            client.getJerseyClient().setReadTimeout(eagleServiceConfig.readTimeoutSeconds
* 1000);
+
             String query = String.format("%s[@site=\"%s\"]<@site>{max(currentTimeStamp)}",
                     Constants.JPA_JOB_PROCESS_TIME_STAMP_NAME,
                     mrHistoryJobConfig.getJobHistoryEndpointConfig().site);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9795fbcc/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationProvider.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationProvider.java
b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationProvider.java
index 774aa8a..e7d97d4 100644
--- a/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationProvider.java
+++ b/eagle-jpm/eagle-jpm-mr-history/src/main/java/org/apache/eagle/jpm/mr/history/MRHistoryJobApplicationProvider.java
@@ -16,6 +16,8 @@
  */
 package org.apache.eagle.jpm.mr.history;
 
+import com.codahale.metrics.health.HealthCheck;
+import com.typesafe.config.Config;
 import org.apache.eagle.app.service.ApplicationListener;
 import org.apache.eagle.app.spi.AbstractApplicationProvider;
 
@@ -31,4 +33,9 @@ public class MRHistoryJobApplicationProvider extends AbstractApplicationProvider
     public Optional<ApplicationListener> getApplicationListener() {
         return Optional.of(new MRHistoryJobApplicationListener());
     }
+
+    @Override
+    public HealthCheck getAppHealthCheck(Config config) {
+        return new MRHistoryJobApplicationHealthCheck(config);
+    }
 }
\ No newline at end of file


Mime
View raw message