tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@tomitribe.com>
Subject Re: Cluster + @Schedule
Date Thu, 16 Oct 2014 10:32:59 GMT
Hi

about single execution: no magic a distibuted lock would work (can be
a database, hazelcast or whatever)

about cluster mode you just have to configure quartz in cluster mode
see http://rmannibucau.wordpress.com/2012/08/22/tomee-quartz-configuration-for-scheduled-methods/
and http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-10-16 12:27 GMT+02:00 Leonardo K. Shikida <shikida@gmail.com>:
> Hi
>
> this doubt may sound dumb, but if I have an EJB with a scheduled task like
>
>     @Schedule(dayOfWeek = "*")
>     public void runMeDaily() {...}
>
> and if I am in a clustered environment, is there any way to make this job
> run in only one of the instances? (only once)
>
> of course, I can set a flag somewhere and check it before the execution of
> such task, so only the first cluster instance would run it, but I am
> curious if it's possible using some configuration magic.
>
> another doubt is: if I have 2 clustered tomee instances, how do I make both
> point to the same scheduler? By scheduler I mean something like
>
> Scheduler scheduler = new StdSchedulerFactory().getScheduler("myScheduler");
>
> My feeling is that my cluster will need a centralized quartz scheduler
> service somehow, so if there's some way to do that using tomee, it would be
> useful for me.
>
> TIA
>
> Leo

Mime
View raw message