This is an automated email from the ASF dual-hosted git repository.

journey pushed a commit to branch refactor-worker
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/refactor-worker by this push:
     new 3bafa97  Refactor worker (#2331)
3bafa97 is described below

commit 3bafa97f96b189cf5a394a5b4cc2f12ee9eca9ee
Author: Tboy <guo.ji...@immomo.com>
AuthorDate: Mon Mar 30 10:39:52 2020 +0800

    Refactor worker (#2331)
    
    * let quartz use the same datasource
    
    * move master/worker config from dao.properties to each config
    add master/worker registry test
    
    * move mybatis config from application.properties to SpringConnectionFactory
    
    * move mybatis-plus config from application.properties to 
SpringConnectionFactory
    
    * refactor TaskCallbackService
    
    * add ZookeeperNodeManagerTest
    
    * add NettyExecutorManagerTest
    
    * refactor TaskKillProcessor
    
    * add RandomSelectorTest, RoundRobinSelectorTest, TaskCallbackServiceTest
    
    * add RoundRobinHostManagerTest, ExecutorDispatcherTest
    
    * refactor task response service
    
    * add TaskResponseServiceTest
    
    * modify close method for MasterSchedulerService
---
 .../apache/dolphinscheduler/server/master/MasterServer.java   |  9 ++++++---
 .../server/master/runner/MasterSchedulerService.java          | 11 ++++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
index c66eed0..4258e77 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
@@ -81,6 +81,9 @@ public class MasterServer {
     @Autowired
     private ZKMasterClient zkMasterClient;
 
+    /**
+     * scheduler service
+     */
     @Autowired
     private MasterSchedulerService masterSchedulerService;
 
@@ -160,16 +163,16 @@ public class MasterServer {
             Stopper.stop();
 
             try {
-                //thread sleep 3 seconds for thread quitely stop
+                //thread sleep 3 seconds for thread quietly stop
                 Thread.sleep(3000L);
             }catch (Exception e){
                 logger.warn("thread sleep exception ", e);
             }
+            //
+            this.masterSchedulerService.close();
             this.nettyRemotingServer.close();
             this.masterRegistry.unRegistry();
             this.zkMasterClient.close();
-            this.masterSchedulerService.close();
-
             //close quartz
             try{
                 QuartzExecutors.getInstance().shutdown();
diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
index 2a0e0a9..405ee88 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
 import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 /**
  *  master scheduler thread
@@ -93,7 +94,15 @@ public class MasterSchedulerService extends Thread {
         super.start();
     }
 
-    public void close(){
+    public void close() {
+        masterExecService.shutdown();
+        boolean terminated = false;
+        try {
+            terminated = masterExecService.awaitTermination(5, 
TimeUnit.SECONDS);
+        } catch (InterruptedException ignore) {}
+        if(!terminated){
+            logger.warn("masterExecService shutdown without terminated, 
increase await time");
+        }
         nettyRemotingClient.close();
         logger.info("master schedule service stopped...");
     }

Reply via email to