自动化立体仓库 - WMS系统
luxiaotao1123
2020-07-06 16fe9b24bb2db438cbfa2a32c4d698f9e1cdfdd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.zy.asrs.task;
 
import com.core.common.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
 
import java.util.Date;
 
/**
 * Created by vincent on 2020/6/30
 */
//@Component
public class TestScheduler {
 
    private static final Logger logger = LoggerFactory.getLogger(TestScheduler.class);
 
    @Scheduled(cron = "0/3 * * * * ? ")
    @Async
    public void test() throws InterruptedException {
        while (true) {
            //模拟耗时任务,阻塞10s
            Thread.sleep(10000);
            break;
        }
    }
 
    @Scheduled(cron = "0/3 * * * * ? ")
    @Async
    public void test1() throws InterruptedException {
        System.out.println(DateUtils.convert(new Date()));
    }
 
}