java - 我如何在 Springboot 中为 Thread shedule 命名
问题描述
我有一个有很多时间表的 Java 类,但我想为时间表设置一个名称,但我不知道。当我使用 Java Time 时,这是可能的,但是在 Spring 中怎么做呢?我需要设置一个名称,因为我的系统有很多 Java 线程。
- 使用 Java 时间 new Timer("My Thread")).scheduleAtFixedRate(new 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);
}
解决方案
推荐阅读
- c# - 是否可以在本地托管 Asp.net MVC Web App
- c# - 在 C# -Vsto 中检索 Excel 中所有单元格应用(使用)的所有字体样式
- swift - 选择器行没有在表单中被取消选择(SwiftUI,Xcode 12 beta 4)
- c++ - 在while循环中读取CAN数据的更有效方法
- c++ - CMAKE + SQLite3.dll
- php - Doctrine OneToMany 关系的问题
- ctypes - py 自动化入门
- django - Django BooleanField - 复选框未显示在网站的表单中
- reactjs - React Loader - 尝试在发出 api 请求时获取加载器并在获取响应时停止它
- django - 每当电子邮件发送失败时回滚保存的对象