Unverified Commit 6b8d51b5 authored by gaoyan's avatar gaoyan Committed by GitHub

[Fix]Fixed the JAR task could not use set (#3057)

parent ed1e6951
......@@ -22,7 +22,6 @@ package org.dinky.aop.exception;
import org.dinky.data.enums.Status;
import org.dinky.data.exception.BusException;
import org.dinky.data.result.Result;
import org.dinky.utils.I18n;
import org.apache.commons.lang3.StringUtils;
......@@ -47,7 +46,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import cn.dev33.satoken.exception.NotLoginException;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
/**
......@@ -64,9 +62,6 @@ public class WebExceptionHandler {
@ResponseBody
public Result<Void> busException(BusException e) {
log.error("BusException:", e);
if (StrUtil.isEmpty(e.getMsg())) {
return Result.failed(I18n.getMessage(e.getCode(), e.getMessage()));
}
return Result.failed(e.getMsg());
}
......
......@@ -21,7 +21,6 @@ package org.dinky.data.exception;
import org.dinky.data.enums.Status;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;
......@@ -43,14 +42,14 @@ public class BusException extends RuntimeException {
private static final long serialVersionUID = -2955156471454043812L;
/** 异常信息的code码 */
private String code;
/** 如果有值得话,将不会取i18n里面的错误信息 */
private String msg;
private Status code;
/** 异常信息的参数 */
private Object[] errorArgs;
/** 如果有值得话,将不会取i18n里面的错误信息 */
private String msg;
public BusException(String message) {
super(message);
setMsg(message);
......@@ -58,32 +57,30 @@ public class BusException extends RuntimeException {
public BusException(Status status) {
super(status.getMessage());
setCode(String.valueOf(status.getCode()));
setCode(status);
setMsg(status.getMessage());
}
public BusException(Status status, Object... errorArgs) {
super(status.getMessage());
setCode(String.valueOf(status.getCode()));
setCode(status);
setMsg(StrUtil.format(status.getMessage(), errorArgs));
}
public BusException(String message, Object... args) {
super();
setCode(message);
setErrorArgs(args);
}
/**
* An exception that gets the error message through i 18n
*
* @param code code
* @param message code
* @param e e
* @return {@link BusException}
*/
public static BusException valueOf(String code, Throwable e) {
String errMsg = ExceptionUtil.stacktraceToString(e);
log.error(errMsg);
public static BusException valueOf(String message, Throwable e) {
log.error(message, e);
return new BusException(message + e.getMessage());
}
public static BusException valueOf(Status code, Throwable e) {
log.error(code.getMessage(), e);
return new BusException(code, e.getMessage());
}
......@@ -94,7 +91,7 @@ public class BusException extends RuntimeException {
* @param errorArgs errorArgs
* @return {@link BusException}
*/
public static BusException valueOf(String code, Object... errorArgs) {
public static BusException valueOf(Status code, Object... errorArgs) {
return new BusException(code, errorArgs);
}
......@@ -104,7 +101,7 @@ public class BusException extends RuntimeException {
* @param msg msg
* @return {@link BusException}
*/
public static BusException valueOfMsg(String msg) {
public static BusException valueOf(String msg) {
return new BusException(msg);
}
}
......@@ -65,6 +65,7 @@ import org.dinky.utils.LogUtil;
import org.dinky.utils.SqlUtil;
import org.dinky.utils.URLUtils;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.CoreOptions;
import org.apache.flink.configuration.DeploymentOptions;
import org.apache.flink.configuration.PipelineOptions;
......@@ -256,12 +257,12 @@ public class JobManager {
ready();
JobJarStreamGraphBuilder jobJarStreamGraphBuilder = JobJarStreamGraphBuilder.build(this);
StreamGraph streamGraph = jobJarStreamGraphBuilder.getJarStreamGraph(statement, getDinkyClassLoader());
Configuration configuration =
executor.getCustomTableEnvironment().getConfig().getConfiguration();
if (Asserts.isNotNullString(config.getSavePointPath())) {
streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(
config.getSavePointPath(),
executor.getStreamExecutionEnvironment()
.getConfiguration()
.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
configuration.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
}
try {
if (!useGateway) {
......@@ -282,7 +283,7 @@ public class JobManager {
}
} else {
GatewayResult gatewayResult;
config.addGatewayConfig(executor.getSetConfig());
config.addGatewayConfig(configuration);
if (runMode.isApplicationMode()) {
gatewayResult = Gateway.build(config.getGatewayConfig()).submitJar(getUdfPathContextHolder());
} else {
......
......@@ -170,6 +170,8 @@ EXECUTE JAR WITH (
**样例代码**
```sql
set 'execution.checkpointing.interval'='21 s';
EXECUTE JAR WITH (
'uri'='rs:/jar/flink/demo/SocketWindowWordCount.jar',
'main-class'='org.apache.flink.streaming.examples.socket',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment