|
|
@ -2,9 +2,10 @@ package com.xxl.job.solon;
|
|
|
|
|
|
|
|
|
|
|
|
import com.xxl.job.core.executor.XxlJobExecutor;
|
|
|
|
import com.xxl.job.core.executor.XxlJobExecutor;
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
|
|
|
|
|
import com.xxl.job.solon.service.CloudJobServiceImpl;
|
|
|
|
import org.noear.solon.SolonApp;
|
|
|
|
import org.noear.solon.SolonApp;
|
|
|
|
|
|
|
|
import org.noear.solon.Utils;
|
|
|
|
import org.noear.solon.cloud.CloudManager;
|
|
|
|
import org.noear.solon.cloud.CloudManager;
|
|
|
|
import com.xxl.job.solon.service.CloudJobServiceImpl;
|
|
|
|
|
|
|
|
import org.noear.solon.core.Aop;
|
|
|
|
import org.noear.solon.core.Aop;
|
|
|
|
import org.noear.solon.core.Plugin;
|
|
|
|
import org.noear.solon.core.Plugin;
|
|
|
|
|
|
|
|
|
|
|
@ -15,26 +16,28 @@ import org.noear.solon.core.Plugin;
|
|
|
|
public class XPluginImp implements Plugin {
|
|
|
|
public class XPluginImp implements Plugin {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void start(SolonApp app) {
|
|
|
|
public void start(SolonApp app) {
|
|
|
|
if (XxljobProps.instance.getJobEnable() == false) {
|
|
|
|
if (Utils.isEmpty(XxlJobProps.instance.getServer())) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//注册Job服务
|
|
|
|
if (XxlJobProps.instance.getJobEnable()) {
|
|
|
|
CloudManager.register(CloudJobServiceImpl.instance);
|
|
|
|
//注册Job服务
|
|
|
|
|
|
|
|
CloudManager.register(CloudJobServiceImpl.instance);
|
|
|
|
|
|
|
|
|
|
|
|
//注册构建器和提取器
|
|
|
|
//注册构建器和提取器
|
|
|
|
Aop.context().beanExtractorAdd(XxlJob.class, new XxlJobExtractor());
|
|
|
|
Aop.context().beanExtractorAdd(XxlJob.class, new XxlJobExtractor());
|
|
|
|
|
|
|
|
|
|
|
|
//构建自动配置
|
|
|
|
//构建自动配置
|
|
|
|
Aop.context().beanMake(XxlJobAutoConfig.class);
|
|
|
|
Aop.context().beanMake(XxlJobAutoConfig.class);
|
|
|
|
|
|
|
|
|
|
|
|
Aop.beanOnloaded(() -> {
|
|
|
|
Aop.beanOnloaded(() -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
XxlJobExecutor executor = Aop.get(XxlJobExecutor.class);
|
|
|
|
XxlJobExecutor executor = Aop.get(XxlJobExecutor.class);
|
|
|
|
executor.start();
|
|
|
|
executor.start();
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|