@Override public void start() throws Exception { // init JobHandler Repository initJobHandlerRepository(applicationContext); // refresh GlueFactory GlueFactory.refreshInstance(1); // super start super.start(); }
/** * init */ public void initXxlJobExecutor() { // registry jobhandler XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler()); XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler()); XxlJobExecutor.registJobHandler("httpJobHandler", new HttpJobHandler()); XxlJobExecutor.registJobHandler("commandJobHandler", new CommandJobHandler()); // load executor prop Properties xxlJobProp = loadProperties("xxl-job-executor.properties"); // init executor xxlJobExecutor = new XxlJobExecutor(); xxlJobExecutor.setAdminAddresses(xxlJobProp.getProperty("xxl.job.admin.addresses")); xxlJobExecutor.setAppName(xxlJobProp.getProperty("xxl.job.executor.appname")); xxlJobExecutor.setIp(xxlJobProp.getProperty("xxl.job.executor.ip")); xxlJobExecutor.setPort(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.port"))); xxlJobExecutor.setAccessToken(xxlJobProp.getProperty("xxl.job.accessToken")); xxlJobExecutor.setLogPath(xxlJobProp.getProperty("xxl.job.executor.logpath")); xxlJobExecutor.setLogRetentionDays(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.logretentiondays"))); // start executor try { xxlJobExecutor.start(); } catch (Exception e) { logger.error(e.getMessage(), e); } }
@Override public void start() throws Exception { // init JobHandler Repository initJobHandlerRepository(applicationContext); // refresh GlueFactory GlueFactory.refreshInstance(1); // super start super.start(); }