feat: 3.1.0

1.废除SecurityManagerCaller
This commit is contained in:
byteblogs168 2024-01-31 23:41:58 +08:00
parent 1601b6e64d
commit 28c4a8a49c
5 changed files with 47 additions and 2 deletions

View File

@ -83,7 +83,7 @@ public class LogCaller {
private static Caller tryCreateCaller() {
Caller caller;
try {
caller = new SecurityManagerCaller();
caller = new StackWalkerCaller();
if (null != caller.getCaller() && null != caller.getCallerCaller()) {
return caller;
}

View File

@ -9,6 +9,7 @@ import java.io.Serializable;
*
* @author wodeyangzipingpingwuqi
*/
@Deprecated
public class SecurityManagerCaller extends SecurityManager implements Caller, Serializable {
private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,34 @@
package com.aizuda.easy.retry.common.log.lang;
import java.io.Serializable;
/**
* @author xiaowoniu
* @date 2024-01-31 23:32:15
* @since 2.6.0
*/
public class StackWalkerCaller implements Caller, Serializable {
@Override
public Class<?> getCaller() {
return null;
}
@Override
public Class<?> getCallerCaller() {
StackWalker instance = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
Class<?> callerClass = instance.getCallerClass();
return callerClass;
}
@Override
public Class<?> getCaller(int depth) {
return null;
}
@Override
public boolean isCalledBy(Class<?> clazz) {
return false;
}
}

View File

@ -3,6 +3,8 @@ package com.aizuda.easy.retry.server.job.task.support.callback;
import akka.actor.ActorRef;
import com.aizuda.easy.retry.common.core.enums.JobTaskStatusEnum;
import com.aizuda.easy.retry.common.log.EasyRetryLog;
import com.aizuda.easy.retry.common.log.lang.StackTraceCaller;
import com.aizuda.easy.retry.common.log.lang.StackWalkerCaller;
import com.aizuda.easy.retry.server.common.akka.ActorGenerator;
import com.aizuda.easy.retry.server.common.util.ClientInfoUtils;
import com.aizuda.easy.retry.server.job.task.dto.LogMetaDTO;
@ -28,6 +30,14 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
public class BroadcastClientCallbackHandler extends AbstractClientCallbackHandler {
public static void main(String[] args) {
StackTraceCaller securityManagerCaller = new StackTraceCaller();
StackWalkerCaller stackWalkerCaller = new StackWalkerCaller();
Class<?> callerCaller = stackWalkerCaller.getCallerCaller();
EasyRetryLog.LOCAL.info("aaa");
System.out.println(callerCaller);
System.out.println(securityManagerCaller.getCallerCaller());
}
@Autowired
private JobTaskMapper jobTaskMapper;

View File

@ -24,7 +24,7 @@
<revision>3.1.0-SNAPSHOT</revision>
<dingding-talk.version>1.0.0</dingding-talk.version>
<netty-all.version>4.1.94.Final</netty-all.version>
<hutool-all.version>5.8.19</hutool-all.version>
<hutool-all.version>5.8.25</hutool-all.version>
<mybatis-plus.version>3.5.5</mybatis-plus.version>
<alibaba-dingtalk.version>2.0.0</alibaba-dingtalk.version>
<guava-retrying.version>2.0.0</guava-retrying.version>