XxlJob注解扫描方式优化,支持查找父类以及接口和基于类代理等常见情况
This commit is contained in:
parent
5f6eee85f8
commit
3dd41db79e
|
@ -1715,13 +1715,14 @@ public ReturnT<String> execute(String param) {
|
||||||
- 9、调度中心国际化完善:新增 "中文繁体" 支持。默认为 "zh_CN"/中文简体, 可选范围为 "zh_CN"/中文简体, "zh_TC"/中文繁体 and "en"/英文;
|
- 9、调度中心国际化完善:新增 "中文繁体" 支持。默认为 "zh_CN"/中文简体, 可选范围为 "zh_CN"/中文简体, "zh_TC"/中文繁体 and "en"/英文;
|
||||||
- 10、移除旧类注解JobHandler,推荐使用基于方法注解 "@XxlJob" 的方式进行任务开发;(如需保留类注解JobHandler使用方式,可以参考旧版逻辑定制开发);
|
- 10、移除旧类注解JobHandler,推荐使用基于方法注解 "@XxlJob" 的方式进行任务开发;(如需保留类注解JobHandler使用方式,可以参考旧版逻辑定制开发);
|
||||||
- 11、修复bootstrap.min.css.map 404问题;
|
- 11、修复bootstrap.min.css.map 404问题;
|
||||||
- 12、[迭代中]自定义失败重试时间间隔;
|
- 12、XxlJob注解扫描方式优化,支持查找父类以及接口和基于类代理等常见情况;
|
||||||
- 13、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
|
- 13、[迭代中]自定义失败重试时间间隔;
|
||||||
- 14、[迭代中]新增执行器描述、任务描述属性;
|
- 14、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
|
||||||
- 15、[迭代中]任务执行一次的时候指定IP;
|
- 15、[迭代中]新增执行器描述、任务描述属性;
|
||||||
- 16、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务;
|
- 16、[迭代中]任务执行一次的时候指定IP;
|
||||||
- 17、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
|
- 17、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务;
|
||||||
- 18、[迭代中]优雅停机回调丢失问题修复;
|
- 18、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
|
||||||
|
- 19、[迭代中]优雅停机回调丢失问题修复;
|
||||||
|
|
||||||
|
|
||||||
### TODO LIST
|
### TODO LIST
|
||||||
|
|
|
@ -16,8 +16,6 @@ import org.springframework.core.MethodIntrospector;
|
||||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,12 +79,11 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// init job handler from method
|
// init job handler from method
|
||||||
|
|
||||||
String[] beanDefinitionNames = applicationContext.getBeanNamesForType(Object.class, false, true);
|
String[] beanDefinitionNames = applicationContext.getBeanNamesForType(Object.class, false, true);
|
||||||
for (String beanDefinitionName : beanDefinitionNames) {
|
for (String beanDefinitionName : beanDefinitionNames) {
|
||||||
Object bean = applicationContext.getBean(beanDefinitionName);
|
Object bean = applicationContext.getBean(beanDefinitionName);
|
||||||
|
|
||||||
Map<Method, XxlJob> annotatedMethods = new HashMap<>();
|
Map<Method, XxlJob> annotatedMethods = null; // referred to :org.springframework.context.event.EventListenerMethodProcessor.processBean
|
||||||
try {
|
try {
|
||||||
annotatedMethods = MethodIntrospector.selectMethods(bean.getClass(),
|
annotatedMethods = MethodIntrospector.selectMethods(bean.getClass(),
|
||||||
new MethodIntrospector.MetadataLookup<XxlJob>() {
|
new MethodIntrospector.MetadataLookup<XxlJob>() {
|
||||||
|
@ -96,9 +93,10 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
logger.debug("xxl-job method-jobhandler resolve error for bean[" + beanDefinitionName + "].", ex);
|
||||||
logger.debug("Could not resolve methods for bean with name '" + beanDefinitionName + "'", ex);
|
|
||||||
}
|
}
|
||||||
|
if (annotatedMethods==null || annotatedMethods.isEmpty()) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<Method, XxlJob> methodXxlJobEntry : annotatedMethods.entrySet()) {
|
for (Map.Entry<Method, XxlJob> methodXxlJobEntry : annotatedMethods.entrySet()) {
|
||||||
|
@ -107,6 +105,7 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
||||||
if (xxlJob == null) {
|
if (xxlJob == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = xxlJob.value();
|
String name = xxlJob.value();
|
||||||
if (name.trim().length() == 0) {
|
if (name.trim().length() == 0) {
|
||||||
throw new RuntimeException("xxl-job method-jobhandler name invalid, for[" + bean.getClass() + "#" + method.getName() + "] .");
|
throw new RuntimeException("xxl-job method-jobhandler name invalid, for[" + bean.getClass() + "#" + method.getName() + "] .");
|
||||||
|
|
Loading…
Reference in New Issue