Using Quartz jobs with pre-created objects
I'm using Quartz(1.6.6) , and it's a great system , but one things really bugs me - I want to be able to use non - default constructor for my jobs. (Yes , I've tried the JobFactory , but I don't like this solution. See below)
Meaning- Instead of :
JobDetail jobDetails = new JobDetail(jobUniqueName, JOBS_GROUP,
CrawlJob.class);
I would like to have something that is more similar to the java Executoers:
CrawlJob crawlJob = new CrawlJob(something, somethingelse);
JobDetail jobDetails = new JobDetail(jobUniqueName, JOBS_GROUP,
crawlJob);
I've already seen the documentation on the JobFactory , but this feels like a very bad solution . If I have several 开发者_如何学JAVAtypes of tasks on the same scheduler , the JobFactory will look like an endless case block , and that really doesn't feels right.
Any more ideas?
Can't be done in quartz. This entire framework is written in a C++ mindset ( - not that there's anything wrong with it , some of my best friends... :)
精彩评论