好记性不如烂博客之 Quartz How-To: Using Scheduler Listeners

How-To: Using Scheduler Listeners

 

Creating a SchedulerListener

Extend TriggerListenerSupport and override methods for events you're interested in.

package foo;



import org.quartz.Trigger;

import org.quartz.listeners.SchedulerListenerSupport;



public class MyOtherSchedulerListener extends SchedulerListenerSupport {



    @Override

    public void schedulerStarted() {

        // do something with the event

    }



    @Override

    public void schedulerShutdown() {

        // do something with the event

    }

    

    @Override

    public void jobScheduled(Trigger trigger) {

        // do something with the event

    }

    

}



Registering A SchedulerListener With The Scheduler

scheduler.getListenerManager().addSchedulerListener(mySchedListener);

你可能感兴趣的:(scheduler)