提交 4c7743f3 编写于 作者: 江蓠

code style

上级 f4ef86c5
......@@ -17,6 +17,9 @@
package org.apache.dolphinscheduler.plugin.alert.script;
/**
* OSUtils
*/
public class OSUtils {
public static Boolean isWindows() {
......
......@@ -22,12 +22,22 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ProcessUtils
*/
public class ProcessUtils {
private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class);
/**
* executeScript
*
* @param cmd cmd params
* @return exit code
*/
public static Integer executeScript(String... cmd) {
int exitCode = -1;
......@@ -49,7 +59,7 @@ public class ProcessUtils {
return process.waitFor();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
logger.error("execute alert script error", e.getMessage());
}
return exitCode;
......
......@@ -17,9 +17,6 @@
package org.apache.dolphinscheduler.plugin.alert.script;
import java.util.Arrays;
import java.util.List;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
......@@ -28,6 +25,9 @@ import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.Arrays;
import java.util.List;
/**
* ScriptAlertChannelFactory
*/
......
......@@ -31,7 +31,6 @@ public class ScriptSender {
private static final Logger logger = LoggerFactory.getLogger(ScriptSender.class);
private String scriptPath;
private Integer scriptType;
......@@ -44,7 +43,6 @@ public class ScriptSender {
userParams = config.get(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS);
}
public AlertResult sendScriptAlert(String msg) {
AlertResult alertResult = new AlertResult();
if (ScriptType.of(scriptType).equals(ScriptType.SHELL)) {
......
......@@ -53,7 +53,6 @@ public enum ScriptType {
}
}
public static ScriptType of(Integer code) {
if (SCRIPT_TYPE_MAP.containsKey(code)) {
return SCRIPT_TYPE_MAP.get(code);
......
......@@ -34,12 +34,10 @@ public class StreamGobbler extends Thread {
InputStream inputStream;
StreamGobbler(InputStream inputStream) {
this.inputStream = inputStream;
}
public void run() {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader inputBufferReader = new BufferedReader(inputStreamReader);
......
......@@ -15,14 +15,11 @@
# limitations under the License.
#
content=$1
msg=$2
msg=$1
content=$2
# Write your specific logic here
echo $content
echo $msg
# Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
exit 888
exit 0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册