use of com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController in project elastic-job by dangdangdotcom.
the class JobScheduler method init.
/**
* 初始化作业.
*/
public void init() {
jobExecutor.init();
JobTypeConfiguration jobTypeConfig = jobExecutor.getSchedulerFacade().loadJobConfiguration().getTypeConfig();
JobScheduleController jobScheduleController = new JobScheduleController(createScheduler(jobTypeConfig.getCoreConfig().isMisfire()), createJobDetail(jobTypeConfig.getJobClass()), jobExecutor.getSchedulerFacade(), jobName);
jobScheduleController.scheduleJob(jobTypeConfig.getCoreConfig().getCron());
jobRegistry.addJobScheduleController(jobName, jobScheduleController);
}
use of com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController in project elastic-job by dangdangdotcom.
the class ExecutionService method registerJobBegin.
/**
* 注册作业启动信息.
*
* @param shardingContexts 分片上下文
*/
public void registerJobBegin(final ShardingContexts shardingContexts) {
if (!shardingContexts.getShardingItemParameters().isEmpty() && configService.load(true).isMonitorExecution()) {
serverService.updateServerStatus(ServerStatus.RUNNING);
for (int each : shardingContexts.getShardingItemParameters().keySet()) {
jobNodeStorage.fillEphemeralJobNode(ExecutionNode.getRunningNode(each), "");
jobNodeStorage.replaceJobNode(ExecutionNode.getLastBeginTimeNode(each), System.currentTimeMillis());
JobScheduleController jobScheduleController = JobRegistry.getInstance().getJobScheduleController(jobName);
if (null == jobScheduleController) {
continue;
}
Date nextFireTime = jobScheduleController.getNextFireTime();
if (null != nextFireTime) {
jobNodeStorage.replaceJobNode(ExecutionNode.getNextFireTimeNode(each), nextFireTime.getTime());
}
}
}
}
use of com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController in project elastic-job by dangdangdotcom.
the class AbstractBaseStdJobTest method tearDown.
@After
public void tearDown() throws SchedulerException, NoSuchFieldException {
JobScheduleController jobScheduleController = JobRegistry.getInstance().getJobScheduleController(jobName);
if (null != jobScheduleController) {
JobRegistry.getInstance().getJobScheduleController(jobName).shutdown();
}
ReflectionUtils.setFieldValue(JobRegistry.getInstance(), "instance", null);
}
Aggregations