ermei
 Runnable runnable = new Runnable() {
public void run() {
task to run goes here
try {
body();//需要运行的函数名
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
//e.printStackTrace();
}
}
};//设定一个线程
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
// System.out.println("kaishi检测。。。。");
// 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间
service.scheduleAtFixedRate(runnable, 0, 7, TimeUnit.DAYS);//启动定时扫描

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-12
  • 2021-11-25
  • 2021-12-07
  • 2021-09-29
  • 2022-12-23
  • 2021-09-28
猜你喜欢
  • 2022-01-17
  • 2021-07-15
  • 2021-12-15
  • 2021-12-19
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案