private static void scheduled(){
//创建一个定时执行的线程池
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(3);
scheduledExecutorService.schedule(() -> {
System.out.println("延迟3秒");
}, 3 , TimeUnit.SECONDS);
scheduledExecutorService.scheduleAtFixedRate(() -> {
System.out.println("延迟 1 秒后每三秒执行一次");
}, 1, 3, TimeUnit.SECONDS);
//scheduledExecutorService.shutdown();
}