org.quartz.TriggerListener Maven / Gradle / Ivy
/*
* Copyright 2001-2009 Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.quartz;
import org.quartz.Trigger.CompletedExecutionInstruction;
/**
* The interface to be implemented by classes that want to be informed when a
* {@link Trigger}
fires. In general, applications that use a
* Scheduler
will not have use for this mechanism.
*
* @see ListenerManager#addTriggerListener(TriggerListener, Matcher)
* @see Matcher
* @see Trigger
* @see JobListener
* @see JobExecutionContext
*
* @author James House
*/
public interface TriggerListener {
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Interface.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/**
*
* Get the name of the TriggerListener
.
*
*/
String getName();
/**
*
* Called by the {@link Scheduler}
when a {@link Trigger}
* has fired, and it's associated {@link org.quartz.JobDetail}
* is about to be executed.
*
*
*
* It is called before the vetoJobExecution(..)
method of this
* interface.
*
*
* @param trigger
* The Trigger
that has fired.
* @param context
* The JobExecutionContext
that will be passed to
* the Job
'sexecute(xx)
method.
*/
void triggerFired(Trigger trigger, JobExecutionContext context);
/**
*
* Called by the {@link Scheduler}
when a {@link Trigger}
* has fired, and it's associated {@link org.quartz.JobDetail}
* is about to be executed. If the implementation vetos the execution (via
* returning true
), the job's execute method will not be called.
*
*
*
* It is called after the triggerFired(..)
method of this
* interface.
*
*
* @param trigger
* The Trigger
that has fired.
* @param context
* The JobExecutionContext
that will be passed to
* the Job
'sexecute(xx)
method.
*/
boolean vetoJobExecution(Trigger trigger, JobExecutionContext context);
/**
*
* Called by the {@link Scheduler}
when a {@link Trigger}
* has misfired.
*
*
*
* Consideration should be given to how much time is spent in this method,
* as it will affect all triggers that are misfiring. If you have lots
* of triggers misfiring at once, it could be an issue it this method
* does a lot.
*
*
* @param trigger
* The Trigger
that has misfired.
*/
void triggerMisfired(Trigger trigger);
/**
*
* Called by the {@link Scheduler}
when a {@link Trigger}
* has fired, it's associated {@link org.quartz.JobDetail}
* has been executed, and it's triggered(xx)
method has been
* called.
*
*
* @param trigger
* The Trigger
that was fired.
* @param context
* The JobExecutionContext
that was passed to the
* Job
'sexecute(xx)
method.
* @param triggerInstructionCode
* the result of the call on the Trigger
'striggered(xx)
* method.
*/
void triggerComplete(Trigger trigger, JobExecutionContext context,
CompletedExecutionInstruction triggerInstructionCode);
}