Schedule task runs twice in a cluster

We use the java Cron4j scheduler to schedule tasks that run every night. Now that the same web application is deployed (Tomcat) on the cluster (2 nodes) on the client site, the tasks are performed twice. Is there any way to avoid this problem?

+5
source share
2 answers

I believe that the only way to do this would be to use some external general state, for example, in a database, for example, to provide some kind of lock.

+2
source

webapp , . runCronjobs. web.xml .

, webapp true, false.

-1

All Articles