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.
Compatible with Quartz 2.1.4 and higher, as of Spring 4.1.
setTargetBeanName, setTargetObject, setTargetMethod, setConcurrent
| Modifier and Type | Class and Description |
|---|---|
| public static class | MethodInvokingJobDetailFactoryBean.
Quartz Job implementation that invokes a specified method. |
| public static class | MethodInvokingJobDetailFactoryBean.
Extension of the MethodInvokingJob, implementing the StatefulJob interface. |
| Modifier and Type | Field and Description |
|---|---|
| private ClassLoader | |
| private BeanFactory | |
| private String | |
| private boolean | |
| private String | |
| private org. | |
| private String | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| public org. | getObject()
Implements org. Return an instance (possibly shared or independent) of the object managed by this factory. |
| public Class | getObjectType()
Implements org. Return the type of object that this FactoryBean creates,
or |
| public Class | getTargetClass()
Overrides org. Overridden to support the |
| public Object | getTargetObject()
Overrides org. Overridden to support the |
| public boolean | isSingleton()
Overrides default org. Is the object managed by this factory a singleton? |
| protected void | postProcessJobDetail(org.
the JobDetail prepared by this FactoryBean jobDetailCallback for post-processing the JobDetail to be exposed by this FactoryBean. |
| protected Class | resolveClassName(String
the class name to resolve className)Overrides org. Resolve the given class name into a Class. |
| public void | setBeanClassLoader(ClassLoader
the owning class loader classLoader)Implements org. Callback that supplies the bean |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Callback that supplies the owning factory to a bean instance. |
| public void | setBeanName(String
the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the beanName)BeanFactoryUtils#originalBeanName(String)
method to extract the original bean name (without suffix), if desired.Implements org. Set the name of the bean in the bean factory that created this bean. |
| public void | setConcurrent(boolean concurrent)
Specify whether multiple jobs should be run in a concurrent fashion. |
| public void | |
| public void | |
| public void |
| beanClassLoader | back to summary |
|---|---|
| private ClassLoader beanClassLoader
| |
| beanFactory | back to summary |
|---|---|
| private BeanFactory beanFactory
| |
| beanName | back to summary |
|---|---|
| private String beanName
| |
| concurrent | back to summary |
|---|---|
| private boolean concurrent | |
| group | back to summary |
|---|---|
| private String group | |
| jobDetail | back to summary |
|---|---|
| private org. | |
| name | back to summary |
|---|---|
| private String name
| |
| targetBeanName | back to summary |
|---|---|
| private String targetBeanName
| |
| MethodInvokingJobDetailFactoryBean | back to summary |
|---|---|
| public MethodInvokingJobDetailFactoryBean() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| getObject | back to summary |
|---|---|
| public org. Implements org. Doc from org. Return an instance (possibly shared or independent) of the object managed by this factory. As with a If this FactoryBean is not fully initialized yet at the time of
the call (for example because it is involved in a circular reference),
throw a corresponding As of Spring 2.0, FactoryBeans are allowed to return | |
| getObjectType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return the type of object that this FactoryBean creates,
or This allows one to check for specific types of beans without instantiating objects, for example on autowiring. In the case of implementations that are creating a singleton object, this method should try to avoid singleton creation as far as possible; it should rather estimate the type in advance. For prototypes, returning a meaningful type here is advisable too. This method can be called before this FactoryBean has been fully initialized. It must not rely on state created during initialization; of course, it can still use such state if available. Note Autowiring will simply ignore FactoryBeans that return
| |
| getTargetClass | back to summary |
|---|---|
| public Class Overrides org. Overridden to support the
| |
| getTargetObject | back to summary |
|---|---|
| public Object getTargetObject() Overrides org. Overridden to support the
| |
| isSingleton | back to summary |
|---|---|
| public boolean isSingleton() Overrides default org. Doc from org. Is the object managed by this factory a singleton? That is,
will Note If a FactoryBean indicates to hold a singleton object,
the object returned from The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory; usually, it has to be defined as singleton there. Note This method returning The default implementation returns
| |
| postProcessJobDetail | back to summary |
|---|---|
| protected void postProcessJobDetail(org. Callback for post-processing the JobDetail to be exposed by this FactoryBean. The default implementation is empty. Can be overridden in subclasses.
| |
| resolveClassName | back to summary |
|---|---|
| protected Class Overrides org. Doc from org. Resolve the given class name into a Class. The default implementations uses
| |
| setBeanClassLoader | back to summary |
|---|---|
| public void setBeanClassLoader(ClassLoader classLoader) Implements org. Doc from org. Callback that supplies the bean Invoked after the population of normal bean properties but
before an initialization callback such as
| |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) Implements org. Doc from org. Callback that supplies the owning factory to a bean instance. Invoked after the population of normal bean properties
but before an initialization callback such as
| |
| setBeanName | back to summary |
|---|---|
| public void setBeanName(String beanName) Implements org. Doc from org. Set the name of the bean in the bean factory that created this bean. Invoked after population of normal bean properties but before an
init callback such as
| |
| setConcurrent | back to summary |
|---|---|
| public void setConcurrent(boolean concurrent) Specify whether 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 The default setting is to run jobs concurrently. | |
| setGroup | back to summary |
|---|---|
| public void setGroup(String group) Set the group of the job. Default is the default group of the Scheduler.
| |
| setName | back to summary |
|---|---|
| public void setName(String name) Set the name of the job. Default is the bean name of this FactoryBean. | |
| setTargetBeanName | back to summary |
|---|---|
| public void setTargetBeanName(String targetBeanName) Set the name of the target bean in the Spring BeanFactory. This is an alternative to specifying | |
| Modifier and Type | Field and Description |
|---|---|
| protected static final Log | |
| private MethodInvoker |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | executeInternal(org.
Implements abstract org. Invoke the method via the MethodInvoker. |
| public void |
| logger | back to summary |
|---|---|
| protected static final Log logger | |
| methodInvoker | back to summary |
|---|---|
| private MethodInvoker methodInvoker
| |
| MethodInvokingJob | back to summary |
|---|---|
| public MethodInvokingJob() | |
| executeInternal | back to summary |
|---|---|
| protected void executeInternal(org. Implements abstract org. Invoke the method via the MethodInvoker.
| |
| setMethodInvoker | back to summary |
|---|---|
| public void setMethodInvoker(MethodInvoker methodInvoker) Set the MethodInvoker to use. | |
| Access | Constructor and Description |
|---|---|
| public |
| StatefulMethodInvokingJob | back to summary |
|---|---|
| public StatefulMethodInvokingJob() | |