ThisApplication.java 1.3 KB
Newer Older
R
roo00 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package com.x.query.service.processing;

import org.apache.commons.lang3.BooleanUtils;

import com.x.base.core.project.Context;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.query.service.processing.schedule.CrawlCms;
import com.x.query.service.processing.schedule.CrawlWork;
import com.x.query.service.processing.schedule.CrawlWorkCompleted;

public class ThisApplication {

	protected static Context context;

	public static Context context() {
		return context;
	}

	public static void init() {
		try {
			LoggerFactory.setLevel(Config.logLevel().x_query_service_processing());
			if (BooleanUtils.isTrue(Config.query().getCrawlWork().getEnable())) {
R
update  
roo00 已提交
24
				context.schedule(CrawlWork.class, Config.query().getCrawlWork().getCron());
R
roo00 已提交
25 26
			}
			if (BooleanUtils.isTrue(Config.query().getCrawlWork().getEnable())) {
R
update  
roo00 已提交
27
				context.schedule(CrawlWorkCompleted.class, Config.query().getCrawlWorkCompleted().getCron());
R
roo00 已提交
28 29
			}
			if (BooleanUtils.isTrue(Config.query().getCrawlCms().getEnable())) {
R
update  
roo00 已提交
30
				context.schedule(CrawlCms.class, Config.query().getCrawlCms().getCron());
R
roo00 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void destroy() {
		try {
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}