package com.whyc.schedule;
|
|
import com.whyc.factory.ThreadPoolExecutorFactory;
|
import com.whyc.service.VideoService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
@EnableScheduling
|
@Component
|
public class VideoScheduleService {
|
|
@Autowired
|
private VideoService service;
|
|
/**凌晨0点执行一次,录制视频流*/
|
@Scheduled(cron = "0 0 0 * * ? ")
|
public void getAndSaveB247(){
|
ThreadPoolExecutorFactory.getPoolExecutor().execute(()->{
|
//service.getAndSaveB247();
|
});
|
}
|
|
/**凌晨0点0分2秒执行一次,停止上次的录制视频流*/
|
@Scheduled(cron = "2 0 0 * * ? ")
|
public void getAndSaveA250(){
|
ThreadPoolExecutorFactory.getPoolExecutor().execute(()->{
|
//service.getAndSaveA250();
|
});
|
}
|
|
}
|