use of com.xxl.job.core.executor.XxlJobExecutor in project xxl-job by xuxueli.
the class JFinalCoreConfig method initXxlJobExecutor.
private void initXxlJobExecutor() {
// registry jobhandler
XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());
// load executor prop
Prop xxlJobProp = PropKit.use("xxl-job-executor.properties");
// init executor
xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname"));
xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath"));
xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays"));
// start executor
try {
xxlJobExecutor.start();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of com.xxl.job.core.executor.XxlJobExecutor in project xxl-job by xuxueli.
the class NutzSetup method init.
@Override
public void init(NutConfig cfg) {
// regist JobHandler
String[] beanNames = cfg.getIoc().getNamesByType(IJobHandler.class);
if (beanNames == null || beanNames.length == 0) {
return;
}
for (String beanName : beanNames) {
IJobHandler jobHandler = cfg.getIoc().get(IJobHandler.class, beanName);
String name = jobHandler.getClass().getAnnotation(JobHandler.class).value();
XxlJobExecutor.registJobHandler(name, jobHandler);
}
// load executor prop
PropertiesProxy xxlJobProp = new PropertiesProxy("xxl-job-executor.properties");
// init executor
xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname"));
xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath"));
xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays"));
// start executor
try {
xxlJobExecutor.start();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
use of com.xxl.job.core.executor.XxlJobExecutor in project xxl-job by xuxueli.
the class XxlJobConfig method xxlJobExecutor.
@Bean(initMethod = "start", destroyMethod = "destroy")
public XxlJobExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobExecutor xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setAdminAddresses(adminAddresses);
xxlJobExecutor.setAppName(appName);
xxlJobExecutor.setIp(ip);
xxlJobExecutor.setPort(port);
xxlJobExecutor.setAccessToken(accessToken);
xxlJobExecutor.setLogPath(logPath);
xxlJobExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobExecutor;
}
use of com.xxl.job.core.executor.XxlJobExecutor in project nutzboot by nutzam.
the class XxlJobStarter method xxlJobExecutor.
@IocBean(create = "start", depose = "destroy")
public XxlJobExecutor xxlJobExecutor() {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobExecutor xxlJobExecutor = new XxlJobExecutor();
// 声明在application.properties
xxlJobExecutor.setIp(conf.get(PROP_EXECTOR_IP, "0.0.0.0"));
xxlJobExecutor.setPort(conf.getInt(PROP_EXECTOR_PORT, 8081));
xxlJobExecutor.setAppName(conf.get(PROP_EXECTOR_NAME, conf.get("nutz.application.name", "xxl-job-executor")));
xxlJobExecutor.setAdminAddresses(conf.get(PROP_ADMIN_ADDRESSES, "http://127.0.0.1:8080/xxl-job-admin"));
xxlJobExecutor.setLogPath(conf.get(PROP_EXECTOR_LOGPATH, "/var/log/xxl-job/jobhandler/"));
xxlJobExecutor.setAccessToken(conf.get(PROP_ACCESSTOKEN, ""));
return xxlJobExecutor;
}
Aggregations