@ -32,17 +32,13 @@ import org.quartz.simpl.SimpleThreadPool;
@@ -32,17 +32,13 @@ import org.quartz.simpl.SimpleThreadPool;
import org.quartz.spi.JobFactory ;
import org.springframework.beans.BeanUtils ;
import org.springframework.beans.factory.BeanInitializationException ;
import org.springframework.beans.factory.BeanNameAware ;
import org.springframework.beans.factory.DisposableBean ;
import org.springframework.beans.factory.FactoryBean ;
import org.springframework.beans.factory.InitializingBean ;
import org.springframework.context.ApplicationContext ;
import org.springframework.context.ApplicationContextAware ;
import org.springframework.context.ApplicationEvent ;
import org.springframework.context.ApplicationListener ;
import org.springframework.context.Lifecycle ;
import org.springframework.context.event.ContextRefreshedEvent ;
import org.springframework.context.SmartLifecycle ;
import org.springframework.core.io.Resource ;
import org.springframework.core.io.ResourceLoader ;
import org.springframework.core.io.support.PropertiesLoaderUtils ;
@ -90,9 +86,8 @@ import org.springframework.util.CollectionUtils;
@@ -90,9 +86,8 @@ import org.springframework.util.CollectionUtils;
* @see org . quartz . impl . StdSchedulerFactory
* @see org . springframework . transaction . interceptor . TransactionProxyFactoryBean
* /
public class SchedulerFactoryBean extends SchedulerAccessor
implements FactoryBean < Scheduler > , BeanNameAware , ApplicationContextAware ,
ApplicationListener < ApplicationEvent > , InitializingBean , DisposableBean , Lifecycle {
public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBean < Scheduler > , BeanNameAware ,
ApplicationContextAware , InitializingBean , DisposableBean , SmartLifecycle {
public static final String PROP_THREAD_COUNT = "org.quartz.threadPool.threadCount" ;
@ -369,6 +364,15 @@ public class SchedulerFactoryBean extends SchedulerAccessor
@@ -369,6 +364,15 @@ public class SchedulerFactoryBean extends SchedulerAccessor
this . autoStartup = autoStartup ;
}
/ * *
* Return whether this scheduler is configured for auto - startup . If "true" ,
* the scheduler will start after the context is refreshed and after the
* start delay , if any .
* /
public boolean isAutoStartup ( ) {
return this . autoStartup ;
}
/ * *
* Set the number of seconds to wait after initialization before
* starting the scheduler asynchronously . Default is 0 , meaning
@ -678,23 +682,6 @@ public class SchedulerFactoryBean extends SchedulerAccessor
@@ -678,23 +682,6 @@ public class SchedulerFactoryBean extends SchedulerAccessor
}
//---------------------------------------------------------------------
// Implementation of ApplicationListener interface
//---------------------------------------------------------------------
public void onApplicationEvent ( ApplicationEvent event ) {
// auto-start Scheduler if demanded
if ( event instanceof ContextRefreshedEvent & & this . autoStartup ) {
try {
startScheduler ( this . scheduler , this . startupDelay ) ;
}
catch ( SchedulerException e ) {
throw new BeanInitializationException ( "failed to auto-start scheduler" , e ) ;
}
}
}
//---------------------------------------------------------------------
// Implementation of Lifecycle interface
//---------------------------------------------------------------------
@ -702,7 +689,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor
@@ -702,7 +689,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor
public void start ( ) throws SchedulingException {
if ( this . scheduler ! = null ) {
try {
this . scheduler . start ( ) ;
startScheduler ( this . scheduler , this . startupDelay ) ;
}
catch ( SchedulerException ex ) {
throw new SchedulingException ( "Could not start Quartz Scheduler" , ex ) ;