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.transaction.xa;
38
39 /**
40 * The XAException is thrown by the Resource Manager (RM) to inform the
41 * Transaction Manager of an error encountered by the involved
42 * transaction.
43 */
44 public class XAException extends java.lang.Exception {
45
46 /**
47 * The error code with which to create the SystemException.
48 *
49 * @serial The error code for the exception.
50 */
51
52 public int errorCode;
53
54 /**
55 * Create an XAException.
56 */
57 public XAException()
58 {
59 super();
60 }
61
62 /**
63 * Create an XAException with a given string.
64 *
65 * @param s The <code>String</code> object containing the exception
66 * message.
67 */
68 public XAException(String s)
69 {
70 super(s);
71 }
72
73 /**
74 * Create an XAException with a given error code.
75 *
76 * @param errcode The error code identifying the exception.
77 */
78 public XAException(int errcode)
79 {
80 super();
81 errorCode = errcode;
82 }
83
84 /**
85 * The inclusive lower bound of the rollback codes.
86 */
87 public final static int XA_RBBASE = 100;
88
89 /**
90 * Indicates that the rollback was caused by an unspecified reason.
91 */
92 public final static int XA_RBROLLBACK = XA_RBBASE;
93
94 /**
95 * Indicates that the rollback was caused by a communication failure.
96 */
97 public final static int XA_RBCOMMFAIL = XA_RBBASE + 1;
98
99 /**
100 * A deadlock was detected.
101 */
102 public final static int XA_RBDEADLOCK = XA_RBBASE + 2;
103
104 /**
105 * A condition that violates the integrity of the resource was detected.
106 */
107 public final static int XA_RBINTEGRITY = XA_RBBASE + 3;
108
109 /**
110 * The resource manager rolled back the transaction branch for a reason
111 * not on this list.
112 */
113 public final static int XA_RBOTHER = XA_RBBASE + 4;
114
115 /**
116 * A protocol error occurred in the resource manager.
117 */
118 public final static int XA_RBPROTO = XA_RBBASE + 5;
119
120 /**
121 * A transaction branch took too long.
122 */
123 public final static int XA_RBTIMEOUT = XA_RBBASE + 6;
124
125 /**
126 * May retry the transaction branch.
127 */
128 public final static int XA_RBTRANSIENT = XA_RBBASE + 7;
129
130 /**
131 * The inclusive upper bound of the rollback error code.
132 */
133 public final static int XA_RBEND = XA_RBTRANSIENT;
134
135 /**
136 * Resumption must occur where the suspension occurred.
137 */
138 public final static int XA_NOMIGRATE = 9;
139
140 /**
141 * The transaction branch may have been heuristically completed.
142 */
143 public final static int XA_HEURHAZ = 8;
144
145 /**
146 * The transaction branch has been heuristically committed.
147 */
148 public final static int XA_HEURCOM = 7;
149
150 /**
151 * The transaction branch has been heuristically rolled back.
152 */
153 public final static int XA_HEURRB = 6;
154
155 /**
156 * The transaction branch has been heuristically committed and
157 * rolled back.
158 */
159 public final static int XA_HEURMIX = 5;
160
161 /**
162 * Routine returned with no effect and may be reissued.
163 */
164 public final static int XA_RETRY = 4;
165
166 /**
167 * The transaction branch was read-only and has been committed.
168 */
169 public final static int XA_RDONLY = 3;
170
171 /**
172 * There is an asynchronous operation already outstanding.
173 */
174 public final static int XAER_ASYNC = -2;
175
176 /**
177 * A resource manager error has occurred in the transaction branch.
178 */
179 public final static int XAER_RMERR = -3;
180
181 /**
182 * The XID is not valid.
183 */
184 public final static int XAER_NOTA = -4;
185
186 /**
187 * Invalid arguments were given.
188 */
189 public final static int XAER_INVAL = -5;
190
191 /**
192 * Routine was invoked in an improper context.
193 */
194 public final static int XAER_PROTO = -6;
195
196 /**
197 * Resource manager is unavailable.
198 */
199 public final static int XAER_RMFAIL = -7;
200
201 /**
202 * The XID already exists.
203 */
204 public final static int XAER_DUPID = -8;
205
206 /**
207 * The resource manager is doing work outside a global transaction.
208 */
209 public final static int XAER_OUTSIDE = -9;
210
211
212 }