Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
Quartz and JavaConfig Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz and JavaConfig

    Hi All,

    I have a Quartz SchedulerFactoryBean configured in my JavaConfig, when I have it defined as :

    Code:
    	@Bean(scope = DefaultScopes.SINGLETON, destroyMethodName="destroy")
    	public SchedulerFactoryBean quartzScheduler() throws ParseException {
    		
    		SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
    		
    		Trigger[] triggers = {EmailTrigger(), EscalationTrigger()};
    		
    		quartzScheduler.setTriggers(triggers);
    		
    		quartzScheduler.setApplicationContextSchedulerContextKey("applicationContext");
    		
    		Properties quartzProperties = new Properties();
    		quartzProperties.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
    		quartzProperties.put("org.quartz.threadPool.threadCount", "5");
    		
    		quartzScheduler.setQuartzProperties(quartzProperties);
    		
    		return quartzScheduler;	
    	}
    The Quartz threads do not start up.

    If I define it this way:
    Code:
    	@Bean(scope = DefaultScopes.SINGLETON, destroyMethodName="destroy")
    	public Object quartzScheduler() throws ParseException {
    		
    		SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
    		
    		Trigger[] triggers = {EmailTrigger(), EscalationTrigger()};
    		
    		quartzScheduler.setTriggers(triggers);
    		
    		quartzScheduler.setApplicationContextSchedulerContextKey("applicationContext");
    		
    		Properties quartzProperties = new Properties();
    		quartzProperties.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
    		quartzProperties.put("org.quartz.threadPool.threadCount", "5");
    		
    		quartzScheduler.setQuartzProperties(quartzProperties);
    		
    		return this.getObject(quartzScheduler);	
    	}
    The quartz threads start but they do not shutdown when you stop Tomcat. I have tried with and without the destroyMethodName property.

    Any help would be greatly appreciated.

    Thanks,
    Mike

  • #2
    Are you ensuring that the close() method is called on the ApplicationContext? Destruction callbacks will not be called unless close() is called on the ApplicationContext.

    Comment


    • #3
      Hi Chris,

      I found the probelm it was calling the wrong method.

      Thanks for pointing me in the right direction.

      -Mike

      Comment

      Working...
      X