好记性不如烂博客之 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);
posted @ 2013-05-31 16:50  大新博客  阅读(356)  评论(0编辑  收藏  举报