|
|
@ -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.config.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; |
|
|
|
} |
|
|
|
} |
|
|
|