001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.transaction.xa;
023:
024: /**
025: * The XAException is thrown by resource managers in case of problems.
026: *
027: * @version $Revision: 57196 $
028: */
029: public class XAException extends java.lang.Exception {
030:
031: /**
032: * The error code.
033: */
034: public int errorCode = 0;
035:
036: /**
037: * Creates new <code>XAException</code> without detail message.
038: */
039: public XAException() {
040: }
041:
042: /**
043: * Constructs an <code>XAException</code> with the specified detail
044: * message.
045: *
046: * @param msg the detail message.
047: */
048: public XAException(String msg) {
049: super (msg);
050: }
051:
052: /**
053: * Constructs an <code>XAException</code> for the specified error code.
054: *
055: * @param errorCode the error code.
056: */
057: public XAException(int errorCode) {
058: super ();
059: this .errorCode = errorCode;
060: }
061:
062: // STATIC VARIABLES ---------------------------------
063:
064: // changed numbers to match SUNs by pkendall for interoperability
065:
066: // added by kimptoc - needed for jbossmq to compile...
067: // others added by jwalters for completeness
068:
069: /**
070: * Error code indicating that an asynchronous operation is outstanding.
071: */
072: public static final int XAER_ASYNC = -2;
073:
074: /**
075: * Error code indicating that a resource manager error has occurred.
076: */
077: public static final int XAER_RMERR = -3;
078:
079: /**
080: * Error code indicating that an {@link Xid} is not valid.
081: */
082: public static final int XAER_NOTA = -4;
083:
084: /**
085: * Error code indicating that invalid arguments were passed.
086: */
087: public static final int XAER_INVAL = -5;
088:
089: /**
090: * Error code indicating a protocol error. This happens if a method
091: * is invoked on a resource when it is not in the correct state for it.
092: */
093: public static final int XAER_PROTO = -6;
094:
095: /**
096: * Error code indicating that the resource manager has failed and is
097: * not available.
098: */
099: public static final int XAER_RMFAIL = -7;
100:
101: /**
102: * Error code indicating that a Xid given as an argument is already
103: * known to the resource manager.
104: */
105: public static final int XAER_DUPID = -8;
106:
107: /**
108: * Error code indicating that the resource manager is doing work
109: * outside the global transaction.
110: */
111: public static final int XAER_OUTSIDE = -9;
112:
113: // added by jwalters - needed for jboss
114:
115: /**
116: * Error code indicating that the transaction branch was read-only,
117: * and has already been committed.
118: */
119: public static final int XA_RDONLY = 3;
120:
121: /**
122: * Error code indicating that the method invoked returned without having
123: * any effect, and that it may be invoked again.
124: * Note that this constant is not defined in JTA 1.0.1, but appears in
125: * J2EE(TM) as shipped by SUN.
126: */
127: public static final int XA_RETRY = 4;
128:
129: /**
130: * Error code indicating that a heuristic mixed decision was made.
131: * This indicates that parts of the transaction were committed,
132: * while other parts were rolled back.
133: */
134: public static final int XA_HEURMIX = 5;
135:
136: /**
137: * Error code indicating that a heuristic rollback decision was made.
138: */
139: public static final int XA_HEURRB = 6;
140:
141: /**
142: * Error code indicating that a heuristic commit decision was made.
143: */
144: public static final int XA_HEURCOM = 7;
145:
146: /**
147: * Error code indicating that a heuristic decision may have been made.
148: * The outcome of all parts of the transaction is not known, but the
149: * outcome of the known parts are either all committed, or all rolled
150: * back.
151: */
152: public static final int XA_HEURHAZ = 8;
153:
154: /**
155: * Error code indicating that the transaction resumption must happen
156: * where the suspension occurred.
157: */
158: public static final int XA_NOMIGRATE = 9;
159:
160: /**
161: * This is not an error code, but the same as the rollback error code
162: * with the lowest number.
163: */
164: public static final int XA_RBBASE = 100;
165:
166: /**
167: * Rollback error code indicating that the rollback happened for
168: * an unspecified reason.
169: */
170: public static final int XA_RBROLLBACK = 100;
171:
172: /**
173: * Rollback error code indicating that the rollback happened due to a
174: * communications failure.
175: */
176: public static final int XA_RBCOMMFAIL = 101;
177:
178: /**
179: * Rollback error code indicating that the rollback happened because
180: * deadlock was detected.
181: */
182: public static final int XA_RBDEADLOCK = 102;
183:
184: /**
185: * Rollback error code indicating that the rollback happened because
186: * an internal integrity check failed.
187: */
188: public static final int XA_RBINTEGRITY = 103;
189:
190: /**
191: * Rollback error code indicating that the rollback happened for some
192: * reason not fitting any of the other rollback error codes.
193: */
194: public static final int XA_RBOTHER = 104;
195:
196: /**
197: * Rollback error code indicating that the rollback happened due to
198: * a protocol error in the resource manager.
199: */
200: public static final int XA_RBPROTO = 105;
201:
202: /**
203: * Rollback error code indicating that the rollback happened because
204: * of a timeout.
205: */
206: public static final int XA_RBTIMEOUT = 106;
207:
208: /**
209: * Rollback error code indicating that the rollback happened due to a
210: * transient failure. The transaction branch may be retried.
211: */
212: public static final int XA_RBTRANSIENT = 107;
213:
214: /**
215: * This is not an error code, but the same as the rollback error code
216: * with the highest number.
217: */
218: public static final int XA_RBEND = 107;
219: }
|