Quartz scheduler shutdown when two applications share Quartz from the same classloader in JBoss EAP 5

Solution Unverified - Updated -

Issue

  • We have two web applications running on JBoss 5.2.0 EAP Server Instance, each containing a quartz scheduler( Copied quartz-all-1.6.5.jar to JBoss Server Instance LIB directory) doing its own job. I have noticed that if one application is hot deployed, the quartz scheduler in the other application stops running. I would like to know if I am using an incorrect approach.

Below is the code sample used in the scheduler classes. The methods of this class are called from a Servlet Context Listener class or from Servlet's init/destroy methods.

public void startScheduler() {      
    schFac = new StdSchedulerFactory();
    try {
        scheduler = schFac.getScheduler();
        jobDetail = new JobDetail("job1", "group1", ExampleJob.class);
        simpleTrigger = new SimpleTrigger("scheduler1", "scheduler_group1");
        ...
        scheduler.scheduleJob(jobDetail, simpleTrigger);
        scheduler.start();      
    } catch (SchedulerException e) {            
        e.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

public void stopScheduler() {
    if(scheduler != null) {
        try {
            scheduler.deleteJob("job1", "group1");              
            scheduler.shutdown();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 5.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.