1 /*
   2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.transaction.xa;
  27 
  28 /**
  29  * The XAException is thrown by the Resource Manager (RM) to inform the
  30  * Transaction Manager of an error encountered by the involved transaction.
  31  *
  32  */
  33 public class XAException extends Exception {
  34     //private static final long serialVersionUID = -8249683284832867751L;
  35 
  36     /**
  37      * The error code with which to create the SystemException.
  38      *
  39      * @serial The error code for the exception
  40      */
  41     public int errorCode;
  42 
  43     /**
  44      * Create an XAException.
  45      */
  46     public XAException() {
  47         super();
  48     }
  49 
  50     /**
  51      * Create an XAException with a given string.
  52      *
  53      * @param s The <code>String</code> object containing the exception
  54      *          message.
  55      */
  56     public XAException(String s) {
  57         super(s);
  58     }
  59 
  60     /**
  61      * Create an XAException with a given error code.
  62      *
  63      * @param errcode The error code identifying the exception.
  64      */
  65     public XAException(int errcode) {
  66         super();
  67         errorCode = errcode;
  68     }
  69 
  70     /**
  71      * The inclusive lower bound of the rollback codes.
  72      */
  73     public final static int XA_RBBASE = 100;
  74 
  75     /**
  76      * Indicates that the rollback was caused by an unspecified reason.
  77      */
  78     public final static int XA_RBROLLBACK = XA_RBBASE;
  79 
  80     /**
  81      * Indicates that the rollback was caused by a communication failure.
  82      */
  83     public final static int XA_RBCOMMFAIL = XA_RBBASE + 1;
  84 
  85     /**
  86      * A deadlock was detected.
  87      */
  88     public final static int XA_RBDEADLOCK = XA_RBBASE + 2;
  89 
  90     /**
  91      * A condition that violates the integrity of the resource was detected.
  92      */
  93     public final static int XA_RBINTEGRITY = XA_RBBASE + 3;
  94 
  95     /**
  96      * The resource manager rolled back the transaction branch for a reason
  97      * not on this list.
  98      */
  99     public final static int XA_RBOTHER = XA_RBBASE + 4;
 100 
 101     /**
 102      * A protocol error occurred in the resource manager.
 103      */
 104     public final static int XA_RBPROTO = XA_RBBASE + 5;
 105 
 106     /**
 107      * A transaction branch took too long.
 108      */
 109     public final static int XA_RBTIMEOUT = XA_RBBASE + 6;
 110 
 111     /**
 112      * May retry the transaction branch.
 113      */
 114     public final static int XA_RBTRANSIENT = XA_RBBASE + 7;
 115 
 116     /**
 117      * The inclusive upper bound of the rollback error code.
 118      */
 119     public final static int XA_RBEND = XA_RBTRANSIENT;
 120 
 121     /**
 122      * Resumption must occur where the suspension occurred.
 123      */
 124     public final static int XA_NOMIGRATE = 9;
 125 
 126     /**
 127      * The transaction branch may have been heuristically completed.
 128      */
 129     public final static int XA_HEURHAZ = 8;
 130 
 131     /**
 132      * The transaction branch has been heuristically committed.
 133      */
 134     public final static int XA_HEURCOM = 7;
 135 
 136     /**
 137      * The transaction branch has been heuristically rolled back.
 138      */
 139     public final static int XA_HEURRB = 6;
 140 
 141     /**
 142      * The transaction branch has been heuristically committed and
 143      * rolled back.
 144      */
 145     public final static int XA_HEURMIX = 5;
 146 
 147     /**
 148      * Routine returned with no effect and may be reissued.
 149      */
 150     public final static int XA_RETRY = 4;
 151 
 152     /**
 153      * The transaction branch was read-only and has been committed.
 154      */
 155     public final static int XA_RDONLY = 3;
 156 
 157     /**
 158      * There is an asynchronous operation already outstanding.
 159      */
 160     public final static int XAER_ASYNC = -2;
 161 
 162     /**
 163      * A resource manager error has occurred in the transaction branch.
 164      */
 165     public final static int XAER_RMERR = -3;
 166 
 167     /**
 168      * The XID is not valid.
 169      */
 170     public final static int XAER_NOTA = -4;
 171 
 172     /**
 173      * Invalid arguments were given.
 174      */
 175     public final static int XAER_INVAL = -5;
 176 
 177     /**
 178      * Routine was invoked in an inproper context.
 179      */
 180     public final static int XAER_PROTO = -6;
 181 
 182     /**
 183      * Resource manager is unavailable.
 184      */
 185     public final static int XAER_RMFAIL = -7;
 186 
 187     /**
 188      * The XID already exists.
 189      */
 190     public final static int XAER_DUPID = -8;
 191 
 192     /**
 193      * The resource manager is doing work outside a global transaction.
 194      */
 195     public final static int XAER_OUTSIDE = -9;
 196 }