package com.ozs.da.handler;

import com.ozs.da.entity.model.ScheduleRoundEvent;
import com.ozs.da.service.job.JobPutService;
import com.lmax.disruptor.WorkHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author 许明
 * on 2019/3/7.
 * @version 2.0.0
 * 调度轮循事件处理
 */
@Component
public class ScheduleRoundEventHandler implements WorkHandler<ScheduleRoundEvent> {

	public static ScheduleRoundEventHandler scheduleRoundEventHandler;

    @Autowired
    private JobPutService jobPutService;

    @PostConstruct
    public void init() {
        scheduleRoundEventHandler = this;
    }

    @Override
    public void onEvent(ScheduleRoundEvent event) throws Exception {
        //job运行条件判断
        scheduleRoundEventHandler.jobPutService.jobRunConditionJudge(event.getTask());
    }
}
