You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/04/06 09:36:25 UTC

[GitHub] [dolphinscheduler] guoshupei commented on a diff in pull request #9246: [Fix-9221] [alert-server] optimization and gracefully close

guoshupei commented on code in PR #9246:
URL: https://github.com/apache/dolphinscheduler/pull/9246#discussion_r843722394


##########
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertPluginManager.java:
##########
@@ -53,25 +52,22 @@
 public final class AlertPluginManager {
     private static final Logger logger = LoggerFactory.getLogger(AlertPluginManager.class);
 
-    private final PluginDao pluginDao;
+    @Autowired
+    private PluginDao pluginDao;
 
     private final Map<Integer, AlertChannel> channelKeyedById = new HashMap<>();
 
     private final PluginParams warningTypeParams = getWarningTypeParams();
 
-    public AlertPluginManager(PluginDao pluginDao) {
-        this.pluginDao = pluginDao;
-    }
-

Review Comment:
   
   > I recommend keeping the original constructor injection and see what other small partners have suggestions.
   
   Okay,  i agree with you.
   



##########
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java:
##########
@@ -17,73 +17,104 @@
 
 package org.apache.dolphinscheduler.alert;
 
+import org.apache.dolphinscheduler.common.Constants;
+import org.apache.dolphinscheduler.common.IStoppable;
 import org.apache.dolphinscheduler.common.thread.Stopper;
-import org.apache.dolphinscheduler.dao.AlertDao;
 import org.apache.dolphinscheduler.dao.PluginDao;
-import org.apache.dolphinscheduler.dao.entity.Alert;
 import org.apache.dolphinscheduler.remote.NettyRemotingServer;
 import org.apache.dolphinscheduler.remote.command.CommandType;
 import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
-
-import java.io.Closeable;
-import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.PreDestroy;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.SpringApplication;
+import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.context.event.ApplicationReadyEvent;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.event.EventListener;
 
+import javax.annotation.PostConstruct;
+
 @SpringBootApplication
 @ComponentScan("org.apache.dolphinscheduler")
-public class AlertServer implements Closeable {
+public class AlertServer implements IStoppable {

Review Comment:
   > You are right, I suggest that the `IStoppable` code and the AlertServer's distributed code are in one PR. If only `IStoppable` code was committed, then `stop` would be an issue during this period.
   
   Yes, i agree with you. I will remove `IStoppable` , at persent, I have no idea to complete the distribution of `AlertServer` , mainly because `WorkerServer` is directly connected to `AlertServer`



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org