feat: 3.1.0

1. 修复日志打印问题
This commit is contained in:
byteblogs168 2024-02-03 10:10:03 +08:00
parent 692d3b3d18
commit 5e27915052
2 changed files with 24 additions and 33 deletions

View File

@ -1,6 +1,10 @@
package com.aizuda.easy.retry.common.log.lang;
import cn.hutool.core.exceptions.UtilException;
import java.io.Serializable;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* @author xiaowoniu
@ -11,15 +15,29 @@ public class StackWalkerCaller implements Caller, Serializable {
@Override
public Class<?> getCaller() {
return null;
StackWalker instance = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
StackWalker.StackFrame walk = (StackWalker.StackFrame) instance
.walk((Function<Stream<StackWalker.StackFrame>, Object>) stackFrameStream ->
stackFrameStream.skip(2).findFirst().get());
try {
return Class.forName(walk.getClassName());
} catch (ClassNotFoundException e) {
throw new UtilException(e, "[{}] not found!", walk.getClassName());
}
}
@Override
public Class<?> getCallerCaller() {
StackWalker instance = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
Class<?> callerClass = instance.getCallerClass();
return callerClass;
StackWalker.StackFrame walk = (StackWalker.StackFrame) instance
.walk((Function<Stream<StackWalker.StackFrame>, Object>) stackFrameStream ->
stackFrameStream.skip(3).findFirst().get());
try {
return Class.forName(walk.getClassName());
} catch (ClassNotFoundException e) {
throw new UtilException(e, "[{}] not found!", walk.getClassName());
}
}
@Override

View File

@ -1,25 +1,11 @@
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;
import com.aizuda.easy.retry.server.job.task.dto.RealJobExecutorDTO;
import com.aizuda.easy.retry.server.job.task.support.JobTaskConverter;
import com.aizuda.easy.retry.server.job.task.dto.JobExecutorResultDTO;
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobMapper;
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskMapper;
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
import com.aizuda.easy.retry.template.datasource.persistence.po.JobTask;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.aizuda.easy.retry.common.core.enums.JobTaskTypeEnum;
import com.aizuda.easy.retry.server.common.akka.ActorGenerator;
import com.aizuda.easy.retry.server.job.task.dto.JobExecutorResultDTO;
import com.aizuda.easy.retry.server.job.task.support.JobTaskConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@ -30,19 +16,6 @@ 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;
@Autowired
private JobMapper jobMapper;
@Override
public JobTaskTypeEnum getTaskInstanceType() {