【发布时间】:2019-01-10 12:19:55
【问题描述】:
我将应用程序部署在 具有主从属关系的 JBoss 中,因此我的调度程序运行了两次。 ShedLock 不是我的问题的解决方案,因为电子邮件将触发直到用户停用过期的资产。所以我虽然检查请求是来自主机还是从机,并基于它运行我的代码,知道如何计算它或任何其他解决方案。谢谢 我正在使用带有 MySQL db 的 Spring 4.x 和 REST Web 服务。
@Scheduled(cron = "${scheduler.i18n.crontime}")
public void getAssetNotification() {
try {
notificationDao.getAssetNotification(null);
} catch (Exception e) {
logger.error("getAssetNotification() - error in getAssetNotification", e);
}
}
【问题讨论】:
-
我们在主从服务器的主机文件中添加参数,如果从主服务器读取,我们将触发,否则不会触发通知。
标签: java spring-mvc jboss scheduled-tasks