feat(sj_1.2.0-beta1): client-jdk8
This commit is contained in:
parent
f0b4c7964a
commit
abc9d83b9e
32
pom.xml
32
pom.xml
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>2.7.18</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
<description>snail-job</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<revision>1.1.0</revision>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<revision>1.1.0-jdk8</revision>
|
||||
<netty-all.version>4.1.94.Final</netty-all.version>
|
||||
<hutool-all.version>5.8.25</hutool-all.version>
|
||||
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||||
@ -32,14 +32,17 @@
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<commons-logging.version>1.2</commons-logging.version>
|
||||
<jakarta-validation.version>3.0.2</jakarta-validation.version>
|
||||
<jakarta-mail-api.version>2.1.3</jakarta-mail-api.version>
|
||||
<jakarta-mail.version>2.0.3</jakarta-mail.version>
|
||||
<jakarta-activation-api.version>2.1.3</jakarta-activation-api.version>
|
||||
<guava.version>32.0.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>snail-job-common</module>
|
||||
<module>snail-job-server</module>
|
||||
<!-- <module>snail-job-server</module> -->
|
||||
<module>snail-job-client-starter</module>
|
||||
<module>snail-job-datasource</module>
|
||||
<!-- <module>snail-job-datasource</module> -->
|
||||
<module>snail-job-client</module>
|
||||
</modules>
|
||||
|
||||
@ -150,6 +153,21 @@
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>${jakarta-validation.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<version>${jakarta-mail-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.angus</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>${jakarta-mail.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<version>${jakarta-activation-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.rholder</groupId>
|
||||
<artifactId>guava-retrying</artifactId>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<description>snail-job-client-starter</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -22,8 +22,8 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
<description>snail-job-client-common</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
@ -15,8 +15,8 @@
|
||||
<description>snail-job-client-job-core</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
@ -45,14 +45,13 @@ import java.util.concurrent.CancellationException;
|
||||
@Slf4j
|
||||
public class JobExecutorFutureCallback implements FutureCallback<ExecuteResult> {
|
||||
|
||||
private static final String TEXT_MESSAGE_FORMATTER = """
|
||||
<font face="微软雅黑" color=#ff0000 size=4>{}环境 定时任务上报异常</font> \s
|
||||
> IP:{} \s
|
||||
> 空间ID:{} \s
|
||||
> 名称:{} \s
|
||||
> 时间:{} \s
|
||||
> 异常:{} \s
|
||||
\s""";
|
||||
private static final String TEXT_MESSAGE_FORMATTER =
|
||||
"<font face='微软雅黑' color=#ff0000 size=4>{}环境 定时任务上报异常</font> \n" +
|
||||
" > IP:{} \n" +
|
||||
" > 空间ID:{} \n" +
|
||||
" > 名称:{} \n" +
|
||||
" > 时间:{} \n" +
|
||||
" > 异常:{} \n\n";
|
||||
|
||||
private static final JobNettyClient CLIENT = RequestBuilder.<JobNettyClient, NettyResult>newBuilder()
|
||||
.client(JobNettyClient.class)
|
||||
|
@ -15,7 +15,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -4,7 +4,7 @@ import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.model.SnailJobHeaders;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
//import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -15,9 +15,9 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
|
@ -15,9 +15,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -15,9 +15,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -47,6 +47,10 @@
|
||||
<groupId>org.eclipse.angus</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.aviator</groupId>
|
||||
<artifactId>aviator</artifactId>
|
||||
|
@ -31,7 +31,7 @@ import java.util.Date;
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public class Mail implements Builder<MimeMessage> {
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
//import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
@ -17,7 +17,7 @@ import java.util.Properties;
|
||||
* @author Luxiaolei
|
||||
*/
|
||||
public class MailAccount implements Serializable {
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = -6937313421815719204L;
|
||||
|
||||
private static final String MAIL_PROTOCOL = "mail.transport.protocol";
|
||||
|
@ -3,7 +3,7 @@ package com.aizuda.snailjob.common.core.alarm.email;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
//import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 邮件异常
|
||||
@ -11,7 +11,7 @@ import java.io.Serial;
|
||||
* @author xiaoleilu
|
||||
*/
|
||||
public class MailException extends RuntimeException {
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = 8247610319171014183L;
|
||||
|
||||
public MailException(Throwable e) {
|
||||
|
@ -112,15 +112,14 @@ public interface SystemConstants {
|
||||
|
||||
}
|
||||
|
||||
String LOGO = """
|
||||
______ _ __ _____ __ \s
|
||||
.' ____ \\ (_)[ | |_ _| [ | \s
|
||||
| (___ \\_| _ .--. ,--. __ | | | | .--. | |.--. \s
|
||||
_.____`. [ `.-. |`'_\\ :[ | | | _ | / .'`\\ \\| '/'`\\ \\\s
|
||||
| \\____) | | | | |// | |,| | | | | |__' | \\__. || \\__/ |\s
|
||||
\\______.'[___||__]'-;__[___|___] `.____.''.__.'[__;.__.' \s
|
||||
:: Snail Job :: (v{}) \s
|
||||
""";
|
||||
String LOGO =
|
||||
" ______ _ __ _____ __ \n" +
|
||||
".' ____ \\ (_)[ | |_ _| [ | \n" +
|
||||
"| (___ \\_| _ .--. ,--. __ | | | | .--. | |.--. \n" +
|
||||
" _.____`. [ `.-. |`'_\\ :[ | | | _ | / .'`\\ \\| '/'`\\ \\\n" +
|
||||
"| \\____) | | | | |// | |,| | | | |__' | \\__. || \\__/ |\n" +
|
||||
" \\______.'[___||__]'-;__[___|___] `.____.''.__.'[__;.__.' \n" +
|
||||
":: Snail Job :: (v{}) \n";
|
||||
|
||||
/**
|
||||
* 调度时长
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.common.core.enums;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import lombok.Getter;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
@ -38,7 +39,7 @@ public enum RetryStatusEnum {
|
||||
private final Integer status;
|
||||
|
||||
public static final List<Integer> ALLOW_DELETE_STATUS =
|
||||
List.of(RetryStatusEnum.FINISH.getStatus(), RetryStatusEnum.MAX_COUNT.status, RetryStatusEnum.SUSPEND.status);
|
||||
ListUtil.of(RetryStatusEnum.FINISH.getStatus(), RetryStatusEnum.MAX_COUNT.status, RetryStatusEnum.SUSPEND.status);
|
||||
|
||||
RetryStatusEnum(int status) {
|
||||
this.status = status;
|
||||
|
@ -20,12 +20,14 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.method.annotation.HandlerMethodValidationException;
|
||||
//import org.springframework.web.method.annotation.HandlerMethodValidationException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
// TODO: move the server module ?
|
||||
|
||||
/**
|
||||
* @description: 400 统一异常处理
|
||||
* @author: byteblogs
|
||||
@ -60,7 +62,8 @@ public class RestExceptionHandler {
|
||||
@ExceptionHandler({BaseSnailJobException.class})
|
||||
public Result onBusinessException(BaseSnailJobException ex) {
|
||||
log.error("异常类 businessException", ex);
|
||||
if (ex instanceof final SnailJobAuthenticationException authenticationException) {
|
||||
if (ex instanceof SnailJobAuthenticationException) {
|
||||
SnailJobAuthenticationException authenticationException = (SnailJobAuthenticationException)ex;
|
||||
return new Result<String>(authenticationException.getErrorCode(), ex.getMessage());
|
||||
}
|
||||
|
||||
@ -140,16 +143,16 @@ public class RestExceptionHandler {
|
||||
* @param e 异常对象
|
||||
* @return HttpResult
|
||||
*/
|
||||
@ExceptionHandler(HandlerMethodValidationException.class)
|
||||
public Result onHandlerMethodValidationException(HandlerMethodValidationException e) {
|
||||
Object[] detailMessageArguments = e.getDetailMessageArguments();
|
||||
if (detailMessageArguments != null && detailMessageArguments.length > 0) {
|
||||
return new Result<String>(0, detailMessageArguments[0].toString());
|
||||
}
|
||||
|
||||
return new Result<>("参数校验失败");
|
||||
|
||||
}
|
||||
// @ExceptionHandler(HandlerMethodValidationException.class)
|
||||
// public Result onHandlerMethodValidationException(HandlerMethodValidationException e) {
|
||||
// Object[] detailMessageArguments = e.getDetailMessageArguments();
|
||||
// if (detailMessageArguments != null && detailMessageArguments.length > 0) {
|
||||
// return new Result<String>(0, detailMessageArguments[0].toString());
|
||||
// }
|
||||
//
|
||||
// return new Result<>("参数校验失败");
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 400错误
|
||||
|
@ -16,9 +16,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -3,7 +3,7 @@ package com.aizuda.snailjob.common.log.dialect.jdk;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.log.dialect.AbstractLog;
|
||||
|
||||
import java.io.Serial;
|
||||
// import java.io.Serial;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
@ -17,7 +17,7 @@ import static com.aizuda.snailjob.common.log.factory.LogFactory.extractThrowable
|
||||
*/
|
||||
public class JdkLog extends AbstractLog {
|
||||
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = -6843151523380063975L;
|
||||
|
||||
private final transient Logger logger;
|
||||
|
@ -10,7 +10,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.spi.AbstractLogger;
|
||||
|
||||
import java.io.Serial;
|
||||
//import java.io.Serial;
|
||||
|
||||
/**
|
||||
* <a href="http://logging.apache.org/log4j/2.x/index.html">Apache Log4J 2</a> log.<br>
|
||||
@ -19,7 +19,7 @@ import java.io.Serial;
|
||||
*/
|
||||
public class Log4j2Log extends AbstractLog {
|
||||
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = -6843151523380063975L;
|
||||
|
||||
private final transient Logger logger;
|
||||
|
@ -2,7 +2,7 @@ package com.aizuda.snailjob.common.log.lang;
|
||||
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
|
||||
import java.io.Serial;
|
||||
//import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
* @author wodeyangzipingpingwuqi
|
||||
*/
|
||||
public class StackTraceCaller implements Caller, Serializable {
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final int OFFSET = 2;
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.aizuda.snailjob.common.log.lang;
|
||||
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
|
||||
import java.io.Serial;
|
||||
//import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
@ -13,22 +13,23 @@ import java.util.stream.Stream;
|
||||
* @since 2.6.0
|
||||
*/
|
||||
public class StackWalkerCaller implements Caller, Serializable {
|
||||
@Serial
|
||||
// @Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final int OFFSET = 2;
|
||||
|
||||
@Override
|
||||
public Class<?> getCallerCaller() {
|
||||
|
||||
StackWalker instance = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
|
||||
StackWalker.StackFrame walk = (StackWalker.StackFrame) instance
|
||||
.walk((Function<Stream<StackWalker.StackFrame>, Object>) stackFrameStream ->
|
||||
stackFrameStream.skip(OFFSET + 1).findFirst().get());
|
||||
try {
|
||||
return Class.forName(walk.getClassName());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new UtilException(e, "[{}] not found!", walk.getClassName());
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
if (stackTrace.length >= OFFSET + 2) {
|
||||
String className = stackTrace[OFFSET + 1].getClassName();
|
||||
try {
|
||||
return Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new UtilException(e, "[%s] not found!", className);
|
||||
}
|
||||
} else {
|
||||
throw new UtilException("Caller's caller not found!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
Loading…
Reference in New Issue
Block a user