001: /*
002: * Copyright 2004-2005 OpenSymphony
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy
006: * of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations
014: * under the License.
015: *
016: */
017:
018: /*
019: * Previously Copyright (c) 2001-2004 James House
020: */
021: package org.quartz;
022:
023: /**
024: * <p>
025: * An exception that can be thrown by a <code>{@link org.quartz.Job}</code>
026: * to indicate to the Quartz <code>{@link Scheduler}</code> that an error
027: * occured while executing, and whether or not the <code>Job</code> requests
028: * to be re-fired immediately (using the same <code>{@link JobExecutionContext}</code>,
029: * or whether it wants to be unscheduled.
030: * </p>
031: *
032: * <p>
033: * Note that if the flag for 'refire immediately' is set, the flags for
034: * unscheduling the Job are ignored.
035: * </p>
036: *
037: * @see Job
038: * @see JobExecutionContext
039: * @see SchedulerException
040: *
041: * @author James House
042: */
043: public class JobExecutionException extends SchedulerException {
044:
045: /*
046: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
047: *
048: * Data members.
049: *
050: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
051: */
052:
053: private boolean refire = false;
054:
055: private boolean unscheduleTrigg = false;
056:
057: private boolean unscheduleAllTriggs = false;
058:
059: /*
060: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
061: *
062: * Constructors.
063: *
064: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
065: */
066:
067: /**
068: * <p>
069: * Create a JobExcecutionException, with the 're-fire immediately' flag set
070: * to <code>false</code>.
071: * </p>
072: */
073: public JobExecutionException() {
074: }
075:
076: /**
077: * <p>
078: * Create a JobExcecutionException, with the given cause.
079: * </p>
080: */
081: public JobExecutionException(Throwable cause) {
082: super (cause);
083: }
084:
085: /**
086: * <p>
087: * Create a JobExcecutionException, with the given message.
088: * </p>
089: */
090: public JobExecutionException(String msg) {
091: super (msg);
092: }
093:
094: /**
095: * <p>
096: * Create a JobExcecutionException with the 're-fire immediately' flag set
097: * to the given value.
098: * </p>
099: */
100: public JobExecutionException(boolean refireImmediately) {
101: refire = refireImmediately;
102: }
103:
104: /**
105: * <p>
106: * Create a JobExcecutionException with the given underlying exception, and
107: * the 're-fire immediately' flag set to the given value.
108: * </p>
109: */
110: public JobExecutionException(Throwable cause,
111: boolean refireImmediately) {
112: super (cause);
113:
114: refire = refireImmediately;
115: }
116:
117: /**
118: * <p>
119: * Create a JobExcecutionException with the given message, and underlying
120: * exception.
121: * </p>
122: */
123: public JobExecutionException(String msg, Throwable cause) {
124: super (msg, cause);
125: }
126:
127: /**
128: * <p>
129: * Create a JobExcecutionException with the given message, and underlying
130: * exception, and the 're-fire immediately' flag set to the given value.
131: * </p>
132: */
133: public JobExecutionException(String msg, Throwable cause,
134: boolean refireImmediately) {
135: super (msg, cause);
136:
137: refire = refireImmediately;
138: }
139:
140: /**
141: * Create a JobExcecutionException with the given message and the 're-fire
142: * immediately' flag set to the given value.
143: */
144: public JobExecutionException(String msg, boolean refireImmediately) {
145: super (msg);
146:
147: refire = refireImmediately;
148: }
149:
150: /*
151: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152: *
153: * Interface.
154: *
155: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156: */
157:
158: public boolean refireImmediately() {
159: return refire;
160: }
161:
162: public void setUnscheduleFiringTrigger(boolean unscheduleTrigg) {
163: this .unscheduleTrigg = unscheduleTrigg;
164: }
165:
166: public boolean unscheduleFiringTrigger() {
167: return unscheduleTrigg;
168: }
169:
170: public void setUnscheduleAllTriggers(boolean unscheduleAllTriggs) {
171: this .unscheduleAllTriggs = unscheduleAllTriggs;
172: }
173:
174: public boolean unscheduleAllTriggers() {
175: return unscheduleAllTriggs;
176: }
177:
178: }
|