执行器初始化逻辑优化:修复懒加载的Bean被提前初始化问题;

This commit is contained in:
xuxueli 2020-03-29 04:21:44 +08:00
parent 9fd8e1eb83
commit 2665933180
2 changed files with 16 additions and 11 deletions

View File

@ -1728,12 +1728,13 @@ method: get 或 post
data: post-data data: post-data
``` ```
- 15、执行器注册逻辑优化新增配置项 ”注册地址 / xxl.job.executor.address“优先使用该配置作为注册地址为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。 - 15、执行器注册逻辑优化新增配置项 ”注册地址 / xxl.job.executor.address“优先使用该配置作为注册地址为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
- 16、[迭代中]自定义失败重试时间间隔; - 16、执行器初始化逻辑优化修复懒加载的Bean被提前初始化问题
- 17、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息; - 17、[迭代中]自定义失败重试时间间隔;
- 18、[迭代中]新增执行器描述、任务描述属性; - 18、[迭代中]任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
- 19、[迭代中]任务执行一次的时候指定IP - 19、[迭代中]新增执行器描述、任务描述属性;
- 20、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务; - 20、[迭代中]任务执行一次的时候指定IP
- 21、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败; - 21、[迭代中]任务日志支持单个清理和状态转移,方便触发子任务;
- 22、[迭代中]任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
### TODO LIST ### TODO LIST

View File

@ -9,7 +9,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.core.MethodIntrospector; import org.springframework.core.MethodIntrospector;
@ -24,13 +24,13 @@ import java.util.Map;
* *
* @author xuxueli 2018-11-01 09:24:52 * @author xuxueli 2018-11-01 09:24:52
*/ */
public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware, InitializingBean, DisposableBean { public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware, SmartInitializingSingleton, DisposableBean {
private static final Logger logger = LoggerFactory.getLogger(XxlJobSpringExecutor.class); private static final Logger logger = LoggerFactory.getLogger(XxlJobSpringExecutor.class);
// start // start
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterSingletonsInstantiated() {
// init JobHandler Repository // init JobHandler Repository
/*initJobHandlerRepository(applicationContext);*/ /*initJobHandlerRepository(applicationContext);*/
@ -42,7 +42,11 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
GlueFactory.refreshInstance(1); GlueFactory.refreshInstance(1);
// super start // super start
try {
super.start(); super.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
// destroy // destroy
@ -93,7 +97,7 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
} }
}); });
} catch (Throwable ex) { } catch (Throwable ex) {
logger.debug("xxl-job method-jobhandler resolve error for bean[" + beanDefinitionName + "].", ex); logger.error("xxl-job method-jobhandler resolve error for bean[" + beanDefinitionName + "].", ex);
} }
if (annotatedMethods==null || annotatedMethods.isEmpty()) { if (annotatedMethods==null || annotatedMethods.isEmpty()) {
continue; continue;