package com.cloudroam.task;
|
|
import lombok.extern.slf4j.Slf4j;
|
import javax.annotation.PostConstruct;
|
import java.util.concurrent.Executors;
|
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.TimeUnit;
|
|
/**
|
* @author taojie
|
*
|
* 1.根据数据库配置的邮箱地址来发送邮件
|
* 2.根据数据库任务配置时间来发送邮件
|
*/
|
//@Component
|
@Slf4j
|
public class PmsTaskExecutors {
|
|
private final static ScheduledExecutorService scheduler= Executors.newScheduledThreadPool(5);
|
|
@PostConstruct
|
public void init() {
|
scheduler.scheduleAtFixedRate(() -> {
|
try {
|
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}, 0, 1, TimeUnit.MINUTES); // 每隔一分钟检查一次数据库
|
}
|
|
}
|