opt: 线程池线程复用导致链路id相同

This commit is contained in:
2024-07-15 15:40:27 +08:00
parent 3e3a129372
commit f085095da5

View File

@@ -1,12 +1,13 @@
package org.nl.system.service.quartz.utils;
import cn.hutool.core.util.StrUtil;
import com.yomahub.tlog.core.thread.TLogInheritableTask;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.util.concurrent.Callable;
/**
* 执行定时任务
@@ -14,7 +15,7 @@ import java.util.concurrent.Callable;
* @author /
*/
@Slf4j
public class QuartzRunnable implements Callable {
public class QuartzRunnable extends TLogInheritableTask {
private final Object target;
private final Method method;
@@ -32,14 +33,15 @@ public class QuartzRunnable implements Callable {
}
}
@SneakyThrows
@Override
public Object call() throws Exception {
public void runTask() {
ReflectionUtils.makeAccessible(method);
if (StrUtil.isNotEmpty(params)) {
method.invoke(target, params);
} else {
method.invoke(target);
}
return null;
}
}