@Scheduled with cron job needs to run in ONE instance ONLY

36 Views Asked by At

I have been using the following cron job: @Scheduled(cron = ${purge.schedule}, zone = ${purge.timezone}) We have 2 instance running in DEV but this cron job starts 2 processes at the same time. Thats why I m using a table lock mechanism so only one process can executed at a time. But both processes are kicking off at the same time. Is there anyway, I can DELAY one process to kick off little later? I tried the following but didnt work:

@Schedule(initialDelayString = "60000", cron = ${purge.schedule}, zone = ${purge.zone}) and getting error. Can you please advise what/how can I use the @Scheduled with cron and delya at the same code? Thanks in advance.

When i tried with following:

`@Scheduled(initialDelayString = "60000", cron = ${purge.schedule}, zone = ${purge.tim ezone})`

I get the following error saying: "'initialDelay' not supported by cron triggers."

0

There are 0 best solutions below