使用Scheduler默認的單線程,設(shè)置兩個線程都是5秒執(zhí)行一次,一個 sleep8秒,一個不sleep 如果test2每8秒執(zhí)行一次,則為串行 1 2 3 4 5 6 7 8 9 10 @Scheduled(cron ="*/5 * * * * *") publicvoidtest1()throwsInterruptedException { System.out.println("test1, 5秒執(zhí)行一次,每次執(zhí)行sleep 8s"); ...
www.dbjr.com.cn/article/1471...htm 2025-5-30