1

Im developing an application that needs to have some background jobs, for example for sending emails on pending alerts. In a standalone configuration the jobs are configured and working fine with Spring scheduler and scheduled-tasks. But i don't know how to make them work synchonized on a clustered with high avaliability JBoss environment. The main problem is to avoid that jobs on different nodes run at the same time.

I've read this about Quartz:

http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering

But it's not recomended on on a high avaliability scenario:

Never run clustering on separate machines, unless their clocks are synchronized using some form of time-sync service (daemon) that runs very regularly (the clocks must be within a second of each other). See http://www.boulder.nist.gov/timefreq/service/its.htm if you are unfamiliar with how to do this.

By now i have workarounded the synchronization problem with a self made blocking system (Why my pessimistic Locking in JPA with Oracle is not working). But i wish to know if JBoss provides some solution for this certainly common problem.

Community
  • 1
  • 1
Ricardo Vila
  • 1,626
  • 1
  • 18
  • 34

1 Answers1

1

You can try an HA Singleton, which is an EJB Singleton configured to be only running on one node in a cluster. That singleton can then use the EJB Timer Service for scheduling your jobs. See the documentation about HA singleton: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Implement_an_HA_Singleton.html

Jan Martiška
  • 1,151
  • 5
  • 7