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 * An exception that can be thrown by a <code>{@link org.quartz.Job}</code>
27 * to indicate to the Quartz <code>{@link Scheduler}</code> that an error
28 * occured while executing, and whether or not the <code>Job</code> requests
29 * to be re-fired immediately (using the same <code>{@link JobExecutionContext}</code>,
30 * or whether it wants to be unscheduled.
31 * </p>
32 *
33 * <p>
34 * Note that if the flag for 'refire immediately' is set, the flags for
35 * unscheduling the Job are ignored.
36 * </p>
37 *
38 * @see Job
39 * @see JobExecutionContext
40 * @see SchedulerException
41 *
42 * @author James House
43 */
44 public class JobExecutionException extends SchedulerException {
45
46 /*
47 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 *
49 * Data members.
50 *
51 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 */
53
54 private boolean refire = false;
55
56 private boolean unscheduleTrigg = false;
57
58 private boolean unscheduleAllTriggs = false;
59
60 /*
61 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 *
63 * Constructors.
64 *
65 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 */
67
68 /**
69 * <p>
70 * Create a JobExcecutionException, with the 're-fire immediately' flag set
71 * to <code>false</code>.
72 * </p>
73 */
74 public JobExecutionException() {
75 }
76
77 /**
78 * <p>
79 * Create a JobExcecutionException, with the given cause.
80 * </p>
81 */
82 public JobExecutionException(Throwable cause) {
83 super(cause);
84 }
85
86 /**
87 * <p>
88 * Create a JobExcecutionException, with the given message.
89 * </p>
90 */
91 public JobExecutionException(String msg) {
92 super(msg);
93 }
94
95 /**
96 * <p>
97 * Create a JobExcecutionException with the 're-fire immediately' flag set
98 * to the given value.
99 * </p>
100 */
101 public JobExecutionException(boolean refireImmediately) {
102 refire = refireImmediately;
103 }
104
105 /**
106 * <p>
107 * Create a JobExcecutionException with the given underlying exception, and
108 * the 're-fire immediately' flag set to the given value.
109 * </p>
110 */
111 public JobExecutionException(Throwable cause, 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 }