簡體   English   中英

Spring Scheduler運行兩次

[英]Spring scheduler running twice

由於我的調度程序運行了兩次,因此我在主和從屬的JBoss中部署了應用程序。 ShedLock無法解決我的問題,因為電子郵件將觸發,直到用戶停用過期的資產為止。 因此,盡管我檢查了請求是來自主服務器還是從服務器,並基於此請求,我將運行我的代碼,任何想法如何找到它或任何其他解決方案。 謝謝,我正在將Spring 4.x和REST Web服務與MySQL數據庫一起使用。

@Scheduled(cron = "${scheduler.i18n.crontime}")
public void getAssetNotification() {
    try {
        notificationDao.getAssetNotification(null);
    } catch (Exception e) {
        logger.error("getAssetNotification() - error in getAssetNotification", e);
    }
}

您不能僅通過數據庫進行同步嗎?

我發現了使用方面的舊代碼片段:

在群集環境中運行的Spring Scheduled Task

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM