1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License("CDDL") (collectively, the "License"). You
9 * may not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
12 * language governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
16 * Sun designates this particular file as subject to the "Classpath" exception
17 * as provided by Sun in the GPL Version 2 section of the License file that
18 * accompanied this code. If applicable, add the following below the License
19 * Header, with the fields enclosed by brackets [] replaced by your own
20 * identifying information: "Portions Copyrighted [year]
21 * [name of copyright owner]"
22 *
23 * Contributor(s):
24 *
25 * If you wish your version of this file to be governed by only the CDDL or
26 * only the GPL Version 2, indicate your decision by adding "[Contributor]
27 * elects to include this software in this distribution under the [CDDL or GPL
28 * Version 2] license." If you don't indicate a single choice of license, a
29 * recipient has the option to distribute your version of this file under
30 * either the CDDL, the GPL Version 2 or to extend the choice of license to
31 * its licensees as provided above. However, if you add GPL Version 2 code
32 * and therefore, elected the GPL Version 2 license, then the option applies
33 * only if the new code is made subject to such option by the copyright
34 * holder.
35 */
36
37 package javax.resource.spi.work;
38
39 /**
40 * This exception is thrown by a <code>WorkManager</code> to indicate that
41 * a submitted <code>Work</code> instance has completed with an exception.
42 *
43 * <p>This could be thrown only after the execution of a
44 * <code>Work</code> instance has started (that is, after a thread has
45 * been allocated for <code>Work</code> execution). The allocated thread sets
46 * up an execution context (if it has been specified), and then calls
47 * <code>Work.run()</code>.
48 *
49 * <p>Any exception thrown during execution context setup or during
50 * <code>Work</code> execution (that is, during <code>Work.run()</code>) is
51 * chained within this exception.
52 *
53 * <p>An associated error code indicates the nature of the error condition.
54 * Possible error codes are <code>WorkException.TX_RECREATE_FAILED</code>,
55 * <code>WorkException.TX_CONCURRENT_WORK_DISALLOWED</code> or
56 * <code>WorkException.UNDEFINED</code>.
57 *
58 * @version 1.0
59 * @author Ram Jeyaraman
60 */
61 public class WorkCompletedException extends WorkException {
62
63 /**
64 * Constructs a new instance with null as its detail message.
65 */
66 public WorkCompletedException() { super(); }
67
68 /**
69 * Constructs a new instance with the specified detail message.
70 *
71 * @param message the detail message.
72 */
73 public WorkCompletedException(String message) {
74 super(message);
75 }
76
77 /**
78 * Constructs a new throwable with the specified cause.
79 *
80 * @param cause a chained exception of type
81 * <code>Throwable</code>.
82 */
83 public WorkCompletedException(Throwable cause) {
84 super(cause);
85 }
86
87 /**
88 * Constructs a new throwable with the specified detail message and cause.
89 *
90 * @param message the detail message.
91 *
92 * @param cause a chained exception of type
93 * <code>Throwable</code>.
94 */
95 public WorkCompletedException(String message, Throwable cause) {
96 super(message, cause);
97 }
98
99 /**
100 * Constructs a new throwable with the specified detail message and
101 * an error code.
102 *
103 * @param message a description of the exception.
104 * @param errorCode a string specifying the vendor specific error code.
105 */
106 public WorkCompletedException(String message, String errorCode) {
107 super(message, errorCode);
108 }
109 }