aplex commented on a change in pull request #3281:
URL: https://github.com/apache/gobblin/pull/3281#discussion_r647045883



##########
File path: 
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GobblinServiceManager.java
##########
@@ -471,21 +310,83 @@ private void  handleLeadershipChange(NotificationContext 
changeContext) {
         helixLeaderGauges.get().setState(LeaderState.SLAVE);
       }
 
-      if (this.isGitConfigMonitorEnabled) {
+      if (configuration.isGitConfigMonitorEnabled()) {
         this.gitConfigMonitor.setActive(false);
       }
 
-      if (this.isDagManagerEnabled) {
+      if (configuration.isDagManagerEnabled()) {
         this.dagManager.setActive(false);
         this.eventBus.unregister(this.dagManager);
       }
     }
   }
 
+  private void registerServicesInLauncher(){
+    if (configuration.isTopologyCatalogEnabled()) {
+      this.serviceLauncher.addService(topologyCatalog);
+    }
+
+    if (configuration.isFlowCatalogEnabled()) {
+      this.serviceLauncher.addService(flowCatalog);
+
+      if (configuration.isGitConfigMonitorEnabled()) {
+        this.serviceLauncher.addService(gitConfigMonitor);
+      }
+    }
+
+    if (configuration.isDagManagerEnabled()) {
+      this.serviceLauncher.addService(dagManager);
+    }
+
+    if (configuration.isJobStatusMonitorEnabled()) {
+      this.serviceLauncher.addService(jobStatusMonitor);
+    }
+
+    if (configuration.isSchedulerEnabled()) {
+      this.serviceLauncher.addService(schedulerService);
+      this.serviceLauncher.addService(scheduler);
+    }
+
+    if (configuration.isRestLIServerEnabled()) {
+      this.serviceLauncher.addService(restliServer);
+    }
+  }
+
+  private void configureServices(){
+    if (configuration.isRestLIServerEnabled()) {
+      this.restliServer = EmbeddedRestliServer.builder()
+          .resources(Lists.newArrayList(FlowConfigsResource.class, 
FlowConfigsV2Resource.class))
+          .injector(injector)
+          .build();
+
+      if 
(configuration.getInnerConfig().hasPath(ServiceConfigKeys.SERVICE_PORT)) {
+        
this.restliServer.setPort(configuration.getInnerConfig().getInt(ServiceConfigKeys.SERVICE_PORT));
+      }
+    }
+
+    registerServicesInLauncher();
+
+    // Register Scheduler to listen to changes in Flows
+    if (configuration.isSchedulerEnabled()) {
+      this.flowCatalog.addListener(this.scheduler);
+    }
+  }
+
+  void ensureInjected() {

Review comment:
       updated




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to