有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在Springboot中为线程调度命名

我有一个Java类,它有很多计划,但是我想为计划设置一个名称,但是我不知道。当我使用Java时间时,这是可能的,但在春季如何做到呢? 我需要设置一个名字,因为我的系统有很多Java线程

  • 用Java时间 新定时器(“我的线程”))。scheduleAtFixedRate(新TimerTask()

-春天

@Scheduled(cron = "00 00 06 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 11 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 16 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 19 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 22 * * ?", zone = TIME_ZONE)
public void updateCacheEmployee() {

    funcionarioRepository.listAllEmployeeByRFID(Utility.FORCE_UPDATE);
    funcionarioRepository.listAllEmployeeByFingerPrint(Utility.FORCE_UPDATE);
    Utility.print(c, ".....Update the cache: ", Utility.TYPE_ALERT);
}

共 (0) 个答案