0

I deployed the application in JBoss with master and slave due to which my scheduler running twice. ShedLock is not solution for my problem as the email will triger till user deactivate the expired Asset. So I though of checking the request is from master or slave and based on it I will run my code, any idea how to figure it or any other solution. Thank you I am using Spring 4.x and REST web-service with MySQL db.

@Scheduled(cron = "${scheduler.i18n.crontime}")
public void getAssetNotification() {
    try {
        notificationDao.getAssetNotification(null);
    } catch (Exception e) {
        logger.error("getAssetNotification() - error in getAssetNotification", e);
    }
}
Hitesh Kumar
  • 45
  • 1
  • 14
  • we are adding the parameter in host file of master and slave server, if it's read from master we will trigger else will not trigger the notifications. – Hitesh Kumar Mar 14 '19 at 07:22

1 Answers1

0

Couldn't you just do a synchronization over database?

I found an older code snippet using an aspect:

Spring Scheduled Task running in clustered environment