Open MAAARKIN opened 9 years ago
@MAAARKIN, what happens if you add @ApplicationScoped
to your job? I think it will keep its state between executions.
I have 2 jobs, FirstJob and SecondJob, i need that SecondJob just execute when the FirstJob finish, i think that @ApplicationScoped doesn't solve.
How would a stateful job support help you with that problem? What you mean exactly by stateful job?
On Mon, Aug 3, 2015 at 11:14 AM Marcos Antonio do Nascimento Filho < notifications@github.com> wrote:
I have 2 jobs, FirstJob and SecondJob, i need that SecondJob just execute when the FirstJob finish, i think that @ApplicationScoped doesn't solve.
— Reply to this email directly or view it on GitHub https://github.com/caelum/vraptor-quartzjob/issues/13#issuecomment-127257097 .
Well, i think that statefuljob solves the problem of execution concurrently. Will not?
Stateful job won't resolve your case.
StatefulJob
means you will have one instance only for the same job instance. Before trigger a job Foo
, Quartz will check if there is another instance for Foo
. If true, Quartz won't trigger another instance.
This is the same behavior of singleton EJB with @Lock(READ)
.
@garcia-jj omg, so sorry garcia. Probably I got it wrong, i will reformulate my question.
Is possible create a jobs with the same trigger/frequency respecting some ordination? something like what happens with @interceptors (before/after).
obs: sry about my english.
You can use CDI events to solve your case. When job 1finish, trigger the event, and the second class will @Observes
that event.
We can create interface StatefulCronTask to create a statefuljob.
Would be nice if we can put implements StatefulCronTask and we use this to implement our job without concurrency.