zhuangchong commented on a change in pull request #9246:
URL: https://github.com/apache/dolphinscheduler/pull/9246#discussion_r840146095
##########
File path:
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java
##########
@@ -17,43 +17,60 @@
package org.apache.dolphinscheduler.alert;
-import org.apache.dolphinscheduler.alert.api.AlertChannel;
-import org.apache.dolphinscheduler.alert.api.AlertConstants;
-import org.apache.dolphinscheduler.alert.api.AlertData;
-import org.apache.dolphinscheduler.alert.api.AlertInfo;
-import org.apache.dolphinscheduler.alert.api.AlertResult;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.dolphinscheduler.alert.api.*;
Review comment:
code style
##########
File path:
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:
This part is a different spring injection method, it is not recommended
to modify.
##########
File path:
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java
##########
@@ -17,43 +17,60 @@
package org.apache.dolphinscheduler.alert;
-import org.apache.dolphinscheduler.alert.api.AlertChannel;
-import org.apache.dolphinscheduler.alert.api.AlertConstants;
-import org.apache.dolphinscheduler.alert.api.AlertData;
-import org.apache.dolphinscheduler.alert.api.AlertInfo;
-import org.apache.dolphinscheduler.alert.api.AlertResult;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.dolphinscheduler.alert.api.*;
+import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AlertStatus;
import org.apache.dolphinscheduler.common.enums.WarningType;
+import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.Alert;
import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import
org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand;
import
org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseResult;
-
-import org.apache.commons.collections.CollectionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.concurrent.TimeUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
+@Service
+public final class AlertSenderService extends Thread {
+ private static final Logger logger =
LoggerFactory.getLogger(AlertSenderService.class);
-@Component
-public final class AlertSender {
- private static final Logger logger =
LoggerFactory.getLogger(AlertSender.class);
+ @Autowired
+ private AlertDao alertDao;
- private final AlertDao alertDao;
- private final AlertPluginManager alertPluginManager;
+ @Autowired
+ private AlertPluginManager alertPluginManager;
- public AlertSender(AlertDao alertDao, AlertPluginManager
alertPluginManager) {
- this.alertDao = alertDao;
- this.alertPluginManager = alertPluginManager;
Review comment:
same as previous question.
##########
File path:
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertRequestProcessor.java
##########
@@ -36,11 +37,8 @@
public final class AlertRequestProcessor implements NettyRequestProcessor {
private static final Logger logger =
LoggerFactory.getLogger(AlertRequestProcessor.class);
- private final AlertSender alertSender;
-
- public AlertRequestProcessor(AlertSender alertSender) {
- this.alertSender = alertSender;
- }
Review comment:
same as previous question.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]