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>
FactoryBean
implementation 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.Scheduler
createScheduler()
Create the Scheduler instance.org.quartz.Scheduler
getObject()
Return an instance (possibly shared or independent) of the object managed by this factory.void
initialize()
Invoke on initialization after it has set all bean properties supplied.void
setExposeSchedulerInRepository(boolean exposeSchedulerInRepository)
Set whether to expose the Aspectran-managedScheduler
instance in the QuartzSchedulerRepository
.void
setQuartzProperties(java.util.Properties quartzProperties)
Set quartz properties.void
setSchedulerName(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-managedScheduler
instance 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.SchedulerException
Create the Scheduler instance.The default implementation invokes SchedulerFactory's
getScheduler
method. 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.Exception
Description copied from interface:InitializableBean
Invoke on initialization after it has set all bean properties supplied.- Specified by:
initialize
in interfaceInitializableBean
- Throws:
java.lang.Exception
- if initialization fails
-
getObject
public org.quartz.Scheduler getObject()
Description copied from interface:FactoryBean
Return 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:
getObject
in interfaceFactoryBean<org.quartz.Scheduler>
- Returns:
- an instance of the bean (can be null)
-
-