一:先了解哈JAVA jdk自带的线程定时任务处理:
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
//从现在开始,启动线程A,线程A执行完后,延迟5秒钟再次启动线程A进行监控扫描
executor.scheduleWithFixedDelay(A,0,5,TimeUnit.SECONDS);
一:先了解哈JAVA jdk自带的线程定时任务处理:
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
//从现在开始,启动线程A,线程A执行完后,延迟5秒钟再次启动线程A进行监控扫描
executor.scheduleWithFixedDelay(A,0,5,TimeUnit.SECONDS);