001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.transaction.xa;
019:
020: import java.io.Serializable;
021:
022: /**
023: * An XAException is an exception thrown by a Resource Manager to inform the
024: * Transaction Manager of an error which has occurred in relation to a
025: * transaction branch. In addition to the usual exception message, an
026: * XAException carries an errorCode value which provides information about the
027: * error, as defined by the series of integer values defined by the XAException
028: * class.
029: */
030: public class XAException extends Exception implements Serializable {
031:
032: private static final long serialVersionUID = -8249683284832867751L;
033:
034: /**
035: * Code which contains the inclusive lower bound of the rollback error codes
036: */
037: public static final int XA_RBBASE = 100;
038:
039: /**
040: * Code which means that the rollback occurred for an unspecified reason
041: */
042: public static final int XA_RBROLLBACK = 100;
043:
044: /**
045: * Code which means that rollback was caused by a communication failure
046: */
047: public static final int XA_RBCOMMFAIL = 101;
048:
049: /**
050: * Code which means that a failure occurred because a deadlock was detected
051: */
052: public static final int XA_RBDEADLOCK = 102;
053:
054: /**
055: * Code which means that a condition was detected than implies a violation
056: * of the integrity of the resource
057: */
058: public static final int XA_RBINTEGRITY = 103;
059:
060: /**
061: * Code which means that the Resource Manager rolled back the transaction
062: * branch for a reason not separately listed
063: */
064: public static final int XA_RBOTHER = 104;
065:
066: /**
067: * Code which means that a protocol error occurred in the Resource Manager
068: */
069: public static final int XA_RBPROTO = 105;
070:
071: /**
072: * Code which means that a transaction branch took too long
073: */
074: public static final int XA_RBTIMEOUT = 106;
075:
076: /**
077: * Code which means that the caller may retry the transaction branch
078: */
079: public static final int XA_RBTRANSIENT = 107;
080:
081: /**
082: * Code which contains the inclusive upper bound of the rollback error codes
083: */
084: public static final int XA_RBEND = 107;
085:
086: /**
087: * Code which means that resumption must occur where the suspension occurred
088: */
089: public static final int XA_NOMIGRATE = 9;
090:
091: /**
092: * Code which means that the transaction branch may have been heuristically
093: * completed
094: */
095: public static final int XA_HEURHAZ = 8;
096:
097: /**
098: * Code which means that the transaction branch has been heuristically
099: * committed
100: */
101: public static final int XA_HEURCOM = 7;
102:
103: /**
104: * Code which means that the transaction branch has been heuristically
105: * rolled back
106: */
107: public static final int XA_HEURRB = 6;
108:
109: /**
110: * Code which means that the transaction branch has been heuristically
111: * committed and rolled back
112: */
113: public static final int XA_HEURMIX = 5;
114:
115: /**
116: * Code which means that the method returned with no effect and can be
117: * reissued
118: */
119: public static final int XA_RETRY = 4;
120:
121: /**
122: * Code which means that the transaction branch was read only and has been
123: * committed
124: */
125: public static final int XA_RDONLY = 3;
126:
127: /**
128: * Code which means that there is already an asynchronous operation
129: * outstanding
130: */
131: public static final int XAER_ASYNC = -2;
132:
133: /**
134: * Code which means that a Resource Manager error has occurred for the
135: * transaction branch
136: */
137: public static final int XAER_RMERR = -3;
138:
139: /**
140: * Code which means that the XID is not valid
141: */
142: public static final int XAER_NOTA = -4;
143:
144: /**
145: * Code which means that invalid arguments were supplied
146: */
147: public static final int XAER_INVAL = -5;
148:
149: /**
150: * Code which means that the method was invoked in an improper context
151: */
152: public static final int XAER_PROTO = -6;
153:
154: /**
155: * Code which means that the Resource Manager is unavailable
156: */
157: public static final int XAER_RMFAIL = -7;
158:
159: /**
160: * Code which means that the XID already exists
161: */
162: public static final int XAER_DUPID = -8;
163:
164: /**
165: * Work is being done by the Resource Manager outside the boundaries of a
166: * global transaction.
167: */
168: public static final int XAER_OUTSIDE = -9;
169:
170: /**
171: * The errorCode which details the error that has occurred
172: */
173: public int errorCode;
174:
175: /**
176: * Creates an XAException with no message or error code
177: */
178: public XAException() {
179: super ();
180: }
181:
182: /**
183: * Creates an XAException with a supplied message and no error code
184: *
185: * @param theMessage
186: * a String containing the exception message
187: */
188: public XAException(String theMessage) {
189: super (theMessage);
190: }
191:
192: /**
193: * Creates an XAException with a specified error code but no message
194: *
195: * @param errorCode
196: * an integer containing one of the XAException errorCode values
197: */
198: public XAException(int errorCode) {
199: super();
200: this.errorCode = errorCode;
201: }
202: }
|