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 which represent a 'job' to be 27 * performed. 28 * </p> 29 * 30 * <p> 31 * Instances of <code>Job</code> must have a <code>public</code> 32 * no-argument constructor. 33 * </p> 34 * 35 * <p> 36 * <code>JobDataMap</code> provides a mechanism for 'instance member data' 37 * that may be required by some implementations of this interface. 38 * </p> 39 * 40 * @see JobDetail 41 * @see StatefulJob 42 * @see Trigger 43 * @see Scheduler 44 * 45 * @author James House 46 */ 47 public interface Job { 48 49 /* 50 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 51 * 52 * Interface. 53 * 54 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 */ 56 57 /** 58 * <p> 59 * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code> 60 * fires that is associated with the <code>Job</code>. 61 * </p> 62 * 63 * <p> 64 * The implementation may wish to set a 65 * {@link JobExecutionContext#setResult(Object) result} object on the 66 * {@link JobExecutionContext} before this method exits. The result itself 67 * is meaningless to Quartz, but may be informative to 68 * <code>{@link JobListener}s</code> or 69 * <code>{@link TriggerListener}s</code> that are watching the job's 70 * execution. 71 * </p> 72 * 73 * @throws JobExecutionException 74 * if there is an exception while executing the job. 75 */ 76 void execute(JobExecutionContext context) 77 throws JobExecutionException; 78 79 } 80