java ee - @Schedule equivalent for Guice: execute tasks in @singleton at specified intervals -
I am using Google Guice, Guice servlet, and Jersey, an easy way to run scheduled jobs in JVM Want to find I found the following EJB example, which creates "A @ signleton ejb @ schedule method that executes in the background at specified intervals." This is what I want to do but wanted to see an easy way to add EE dependency.
You can probably get quartz integration to meet your needs here -
Here is an example of syntax
@ javax.inject.Singleton @ org.nnsoft.guice.guartz.Scheduled (jobname = "test", cronation = "0" / 2 * * * *? ") Public class com.acme.MyJobImpl apply org.quartz.job {@ javax.inject.Inject Personal MyCustomService service; Public Zero Executes (JobExecutionContext References) JobExecutionException throws {service.customOperation (); }}
Comments
Post a Comment