
Originally Posted by
rpepersack
I want to make sure that my jobs are thread-safe, as Quartz ensures, and set Spring so that the second job will not have to wait until first job has finished, as does the "concurrent" property of MethodInvokingJobDetailFactoryBean.
I don't understand what you want.
So by creating multiple jobs (each job executed by a different thread) you want to make it threadsafe? (isolation/confinement is a very valuable technique for concurrency control). But do you jobs have state?
Personally I prefer making quartz (or any other threading engine) as stupid as possible. If I need to maintain some kind of context(state) for a Job, I make it part of the call.
Code:
class FireService{
void fireThemAll(){
FireThemAllContext context = new FireThemAllContext();
... now pass the context to the locations needed (could also use a threadlocal for this but making it explicit is less vague).
}
}
And now the FireService.fireThemAll Service can be called by the same instance of the QuartzJob (MethodInvoking.... for example) by multiple Quartz-threads.