1 2 /* 3 * Copyright 2004-2005 OpenSymphony 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy 7 * of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations 15 * under the License. 16 * 17 */ 18 19 /* 20 * Previously Copyright (c) 2001-2004 James House 21 */ 22 package org.quartz; 23 24 /** 25 * <p> 26 * The interface to be implemented by classes that want to be informed when a 27 * <code>{@link org.quartz.JobDetail}</code> executes. In general, 28 * applications that use a <code>Scheduler</code> will not have use for this 29 * mechanism. 30 * </p> 31 * 32 * @see Scheduler 33 * @see Job 34 * @see JobExecutionContext 35 * @see JobExecutionException 36 * @see TriggerListener 37 * 38 * @author James House 39 */ 40 public interface JobListener { 41 42 /* 43 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 * 45 * Interface. 46 * 47 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 48 */ 49 50 /** 51 * <p> 52 * Get the name of the <code>JobListener</code>. 53 * </p> 54 */ 55 String getName(); 56 57 /** 58 * <p> 59 * Called by the <code>{@link Scheduler}</code> when a <code>{@link org.quartz.JobDetail}</code> 60 * is about to be executed (an associated <code>{@link Trigger}</code> 61 * has occured). 62 * </p> 63 * 64 * <p> 65 * This method will not be invoked if the execution of the Job was vetoed 66 * by a <code>{@link TriggerListener}</code>. 67 * </p> 68 * 69 * @see #jobExecutionVetoed(JobExecutionContext) 70 */ 71 void jobToBeExecuted(JobExecutionContext context); 72 73 /** 74 * <p> 75 * Called by the <code>{@link Scheduler}</code> when a <code>{@link org.quartz.JobDetail}</code> 76 * was about to be executed (an associated <code>{@link Trigger}</code> 77 * has occured), but a <code>{@link TriggerListener}</code> vetoed it's 78 * execution. 79 * </p> 80 * 81 * @see #jobToBeExecuted(JobExecutionContext) 82 */ 83 void jobExecutionVetoed(JobExecutionContext context); 84 85 86 /** 87 * <p> 88 * Called by the <code>{@link Scheduler}</code> after a <code>{@link org.quartz.JobDetail}</code> 89 * has been executed, and be for the associated <code>Trigger</code>'s 90 * <code>triggered(xx)</code> method has been called. 91 * </p> 92 */ 93 void jobWasExecuted(JobExecutionContext context, 94 JobExecutionException jobException); 95 96 } 97