Package com.aspectran.scheduler.support
Class QuartzSchedulerFactoryBean
- java.lang.Object
-
- com.aspectran.scheduler.support.QuartzSchedulerFactoryBean
-
- All Implemented Interfaces:
FactoryBean<org.quartz.Scheduler>,InitializableBean
public class QuartzSchedulerFactoryBean extends java.lang.Object implements InitializableBean, FactoryBean<org.quartz.Scheduler>
FactoryBeanimplementation that builds a QuartzScheduler.- Since:
- 3.0.0
-
-
Field Summary
-
Fields inherited from interface com.aspectran.core.component.bean.ablility.FactoryBean
FACTORY_METHOD_NAME
-
-
Constructor Summary
Constructors Constructor Description QuartzSchedulerFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.quartz.SchedulercreateScheduler()Create the Scheduler instance.org.quartz.SchedulergetObject()Return an instance (possibly shared or independent) of the object managed by this factory.voidinitialize()Invoke on initialization after it has set all bean properties supplied.voidsetExposeSchedulerInRepository(boolean exposeSchedulerInRepository)Set whether to expose the Aspectran-managedSchedulerinstance in the QuartzSchedulerRepository.voidsetQuartzProperties(java.util.Properties quartzProperties)Set quartz properties.voidsetSchedulerName(java.lang.String schedulerName)Set the name of the Scheduler to create via the SchedulerFactory.
-
-
-
Method Detail
-
setSchedulerName
public void setSchedulerName(java.lang.String schedulerName)
Set the name of the Scheduler to create via the SchedulerFactory.If not specified, the bean name will be used as default scheduler name.
- Parameters:
schedulerName- the scheduler name- See Also:
SchedulerFactory.getScheduler(),SchedulerFactory.getScheduler(String)
-
setQuartzProperties
public void setQuartzProperties(java.util.Properties quartzProperties)
Set quartz properties.- Parameters:
quartzProperties- the quartz properties
-
setExposeSchedulerInRepository
public void setExposeSchedulerInRepository(boolean exposeSchedulerInRepository)
Set whether to expose the Aspectran-managedSchedulerinstance in the QuartzSchedulerRepository. Default is "false", since the Aspectran-managed Scheduler is usually exclusively intended for access within the Aspectran context.Switch this flag to "true" in order to expose the Scheduler globally. This is not recommended unless you have an existing Aspectran application that relies on this behavior.
- Parameters:
exposeSchedulerInRepository- whether to expose scheduler in the quartz scheduler repository
-
createScheduler
protected org.quartz.Scheduler createScheduler() throws org.quartz.SchedulerExceptionCreate the Scheduler instance.The default implementation invokes SchedulerFactory's
getSchedulermethod. Can be overridden for custom Scheduler creation.- Returns:
- the Scheduler instance
- Throws:
org.quartz.SchedulerException- if thrown by Quartz methods- See Also:
SchedulerFactory.getScheduler()
-
initialize
public void initialize() throws java.lang.ExceptionDescription copied from interface:InitializableBeanInvoke on initialization after it has set all bean properties supplied.- Specified by:
initializein interfaceInitializableBean- Throws:
java.lang.Exception- if initialization fails
-
getObject
public org.quartz.Scheduler getObject()
Description copied from interface:FactoryBeanReturn an instance (possibly shared or independent) of the object managed by this factory. As with a BeanFactory, this allows support for both the Singleton and Prototype design pattern.- Specified by:
getObjectin interfaceFactoryBean<org.quartz.Scheduler>- Returns:
- an instance of the bean (can be null)
-
-