package com.apobates.forum.member.impl.quartz;

import com.apobates.forum.member.dao.MemberOnlineDao;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

/**
 * 删除过期的在线记录
 * 
 * @author xiaofanku
 * @since 20200611
 */
public class DuplicateOLRecordsQuartzJob implements Job{
    @Autowired
    private MemberOnlineDao memberOnlineDao;
    @Value("${site.appname}")
    private String appName;
    private final static Logger logger = LoggerFactory.getLogger(DuplicateOLRecordsQuartzJob.class);
    
    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {
        logger.info(String.format("[%s][QuartzTask][Member][2]删除过期的在线记录作业开始", appName));
        memberOnlineDao.deleteDuplicateRecords();
        logger.info("[QuartzTask][Member][2]删除过期的在线记录作业结束");
    }
}