|
|
@ -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;
|
|
|
|