public class AdaptableJobFactory extends Object implements JobFactory
JobFactory
implementation that supports Runnable
objects as well as standard Quartz Job
instances.
Compatible with Quartz 2.1.4 and higher, as of Spring 4.1.
DelegatingJob
,
adaptJob(Object)
Constructor and Description |
---|
AdaptableJobFactory() |
Modifier and Type | Method and Description |
---|---|
protected Job |
adaptJob(Object jobObject)
Adapt the given job object to the Quartz Job interface.
|
protected Object |
createJobInstance(TriggerFiredBundle bundle)
Create an instance of the specified job class.
|
Job |
newJob(TriggerFiredBundle bundle,
Scheduler scheduler) |
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException
newJob
in interface JobFactory
SchedulerException
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception
Can be overridden to post-process the job instance.
bundle
- the TriggerFiredBundle from which the JobDetail
and other info relating to the trigger firing can be obtainedException
- if job instantiation failedprotected Job adaptJob(Object jobObject) throws Exception
The default implementation supports straight Quartz Jobs as well as Runnables, which get wrapped in a DelegatingJob.
jobObject
- the original instance of the specified job classException
- if the given job could not be adaptedDelegatingJob