update document

2.1.2
xuxueli 5 years ago
parent 6659ce1b7d
commit acc399f3bd

@ -5,6 +5,8 @@ import com.xxl.job.core.glue.GlueFactory;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
@ -15,11 +17,12 @@ 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 { public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware, InitializingBean, DisposableBean {
// start
@Override @Override
public void start() throws Exception { public void afterPropertiesSet() throws Exception {
// init JobHandler Repository // init JobHandler Repository
initJobHandlerRepository(applicationContext); initJobHandlerRepository(applicationContext);
@ -32,6 +35,13 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
super.start(); super.start();
} }
// destroy
@Override
public void destroy() {
super.destroy();
}
private void initJobHandlerRepository(ApplicationContext applicationContext){ private void initJobHandlerRepository(ApplicationContext applicationContext){
if (applicationContext == null) { if (applicationContext == null) {
return; return;

@ -38,7 +38,7 @@ public class XxlJobConfig {
private int logRetentionDays; private int logRetentionDays;
@Bean(initMethod = "start", destroyMethod = "destroy") @Bean
public XxlJobSpringExecutor xxlJobExecutor() { public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init."); logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();

Loading…
Cancel
Save