ScheduledExecutorService 延时线程池
//循环执行任务,第一次延迟3秒执行,第二次开始每间隔5秒执行一次。最后一个参数是单位(时间) ScheduledExecutorService service = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() + 1); service.scheduleAtFixedRate(Runable runable,3,5,TimeUnit.SECONDS);
引用 https://blog.csdn.net/weixin_46209120/article/details/119296639