[GitHub] incubator-eagle pull request #750: [EAGLE-843] Refactor application shared s...

2016-12-16 Thread haoch
Github user haoch commented on a diff in the pull request:

https://github.com/apache/incubator-eagle/pull/750#discussion_r92778513
  
--- Diff: 
eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/spi/ApplicationProvider.java
 ---
@@ -72,7 +75,20 @@
  */
 void register(ModuleRegistry registry);
 
-default Optional getAppHealthCheck(Config config) {
+/**
+ * @param config application config.
+ * @return Application-specific managed health check.
+ */
+default Optional getManagedHealthCheck(Config config) {
+return Optional.empty();
+}
+
+/**
+ *
+ * @param envConfig server environment config.
+ * @return Server-level shared services.
+ */
+default Optional getSharedServices(Config envConfig) {
--- End diff --

Change#1: add `Optional getSharedServices(Config envConfig) 
` in `ApplicationProvider`

@qingwen220 @wujinhu 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-eagle pull request #750: [EAGLE-843] Refactor application shared s...

2016-12-16 Thread haoch
Github user haoch commented on a diff in the pull request:

https://github.com/apache/incubator-eagle/pull/750#discussion_r92778778
  
--- Diff: 
eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java ---
@@ -107,18 +111,31 @@ public void run(ServerConfig configuration, 
Environment environment) throws Exce
 // Context listener
 environment.servlets().addServletListeners(new 
CoordinatorListener());
 
+registerAppServices(environment);
+}
+
+private void registerAppServices(Environment environment) {
 // Run application status service in background
-Managed updateAppStatusTask = new 
ApplicationTask(applicationStatusUpdateService);
+LOG.debug("Registering ApplicationStatusUpdateService");
+Managed updateAppStatusTask = new 
ManagedService(applicationStatusUpdateService);
 environment.lifecycle().manage(updateAppStatusTask);
 
-// Initialize application health check environment
+// Initialize application extended health checks.
+LOG.debug("Registering ApplicationHealthCheckService");
 applicationHealthCheckService.init(environment);
-Managed appHealthCheckTask = new 
ApplicationTask(applicationHealthCheckService);
-environment.lifecycle().manage(appHealthCheckTask);
-
-if (config.hasPath(MRHistoryJobDailyReporter.SERVICE_PATH)) {
-Managed jobReportTask = new 
ApplicationTask(mrHistoryJobDailyReporter);
-environment.lifecycle().manage(jobReportTask);
+environment.lifecycle().manage(new 
ManagedService(applicationHealthCheckService));
+
+// Load application shared extension services.
+LOG.debug("Registering application shared extension services");
+for (ApplicationProvider applicationProvider : 
applicationProviderService.getProviders()) {
--- End diff --

Change#3, Register `getSharedServices` from `ApplicationProvider` to 
`Environment` in `ServerApplication`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-eagle pull request #750: [EAGLE-843] Refactor application shared s...

2016-12-16 Thread haoch
GitHub user haoch opened a pull request:

https://github.com/apache/incubator-eagle/pull/750

[EAGLE-843] Refactor application shared service registry framework

Refactor application shared service registry framework

https://issues.apache.org/jira/browse/EAGLE-843

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/haoch/incubator-eagle 
RefactorAppServicesFramework

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-eagle/pull/750.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #750


commit ff8243b74f1474a7bbbc11e40922d7be9822de42
Author: Hao Chen 
Date:   2016-12-16T09:25:52Z

Refactor application shared services




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---