Save This Page
Home » Spring-Framework-090522 » org.springframework » scheduling » quartz » [javadoc | source]
org.springframework.scheduling.quartz
public class: MethodInvokingJobDetailFactoryBean [javadoc | source]
java.lang.Object
   org.springframework.util.MethodInvoker
      org.springframework.beans.support.ArgumentConvertingMethodInvoker
         org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean

All Implemented Interfaces:
    BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, InitializingBean, FactoryBean

org.springframework.beans.factory.FactoryBean that exposes a org.quartz.JobDetail object which delegates job execution to a specified (static or non-static) method. Avoids the need for implementing a one-line Quartz Job that just invokes an existing service method on a Spring-managed target bean.

Inherits common configuration properties from the MethodInvoker base class, such as "targetObject" and "targetMethod" , adding support for lookup of the target bean by name through the "targetBeanName" property (as alternative to specifying a "targetObject" directly, allowing for non-singleton target objects).

Supports both concurrently running jobs and non-currently running jobs through the "concurrent" property. Jobs created by this MethodInvokingJobDetailFactoryBean are by default volatile and durable (according to Quartz terminology).

NOTE: JobDetails created via this FactoryBean are not serializable and thus not suitable for persistent job stores. You need to implement your own Quartz Job as a thin wrapper for each case where you want a persistent job to delegate to a specific service method.

Nested Class Summary:
public static class  MethodInvokingJobDetailFactoryBean.MethodInvokingJob  Quartz Job implementation that invokes a specified method. Automatically applied by MethodInvokingJobDetailFactoryBean. 
public static class  MethodInvokingJobDetailFactoryBean.StatefulMethodInvokingJob  Extension of the MethodInvokingJob, implementing the StatefulJob interface. Quartz checks whether or not jobs are stateful and if so, won't let jobs interfere with each other. 
Method from org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean Summary:
afterPropertiesSet,   getObject,   getObjectType,   getTargetClass,   getTargetObject,   isSingleton,   postProcessJobDetail,   resolveClassName,   setBeanClassLoader,   setBeanFactory,   setBeanName,   setConcurrent,   setGroup,   setJobListenerNames,   setName,   setTargetBeanName
Methods from org.springframework.beans.support.ArgumentConvertingMethodInvoker:
doFindMatchingMethod,   findMatchingMethod,   getDefaultTypeConverter,   getTypeConverter,   registerCustomEditor,   setTypeConverter
Methods from org.springframework.util.MethodInvoker:
findMatchingMethod,   getArguments,   getPreparedMethod,   getTargetClass,   getTargetMethod,   getTargetObject,   getTypeDifferenceWeight,   invoke,   isPrepared,   prepare,   resolveClassName,   setArguments,   setStaticMethod,   setTargetClass,   setTargetMethod,   setTargetObject
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean Detail:
 public  void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException 
 public Object getObject() 
 public Class getObjectType() 
 public Class getTargetClass() 
 public Object getTargetObject() 
 public boolean isSingleton() 
 protected  void postProcessJobDetail(JobDetail jobDetail) 
    Callback for post-processing the JobDetail to be exposed by this FactoryBean.

    The default implementation is empty. Can be overridden in subclasses.

 protected Class resolveClassName(String className) throws ClassNotFoundException 
 public  void setBeanClassLoader(ClassLoader classLoader) 
 public  void setBeanFactory(BeanFactory beanFactory) 
 public  void setBeanName(String beanName) 
 public  void setConcurrent(boolean concurrent) 
    Specify whether or not multiple jobs should be run in a concurrent fashion. The behavior when one does not want concurrent jobs to be executed is realized through adding the StatefulJob interface. More information on stateful versus stateless jobs can be found here.

    The default setting is to run jobs concurrently.

 public  void setGroup(String group) 
    Set the group of the job.

    Default is the default group of the Scheduler.

 public  void setJobListenerNames(String[] names) 
    Set a list of JobListener names for this job, referring to non-global JobListeners registered with the Scheduler.

    A JobListener name always refers to the name returned by the JobListener implementation.

 public  void setName(String name) 
    Set the name of the job.

    Default is the bean name of this FactoryBean.

 public  void setTargetBeanName(String targetBeanName) 
    Set the name of the target bean in the Spring BeanFactory.

    This is an alternative to specifying "targetObject" , allowing for non-singleton beans to be invoked. Note that specified "targetObject" and "targetClass" values will override the corresponding effect of this "targetBeanName" setting (i.e. statically pre-define the bean type or even the bean object).