1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.transaction.xa;
  6. /**
  7. * The XAException is thown by the Resource Manager (RM) to inform the
  8. * Transaction Manager of error encountered for the transaction involved.
  9. *
  10. */
  11. public class XAException extends java.lang.Exception {
  12. /**
  13. * The error code to create the SystemException with
  14. *
  15. * @serial The error code for the exception
  16. */
  17. public int errorCode;
  18. /**
  19. * Create an XAException.
  20. */
  21. public XAException()
  22. {
  23. super();
  24. }
  25. /**
  26. * Create an XAException with a given string.
  27. */
  28. public XAException(String s)
  29. {
  30. super(s);
  31. }
  32. /**
  33. * Create an XAException with a given error code.
  34. */
  35. public XAException(int errcode)
  36. {
  37. super();
  38. errorCode = errcode;
  39. }
  40. /**
  41. * The inclusive lower bound oof the rollback codes.
  42. */
  43. public final static int XA_RBBASE = 100;
  44. /**
  45. * Rollback was caused by unspecified reason.
  46. */
  47. public final static int XA_RBROLLBACK = XA_RBBASE;
  48. /**
  49. * Rollback was caused by communication failure.
  50. */
  51. public final static int XA_RBCOMMFAIL = XA_RBBASE + 1;
  52. /**
  53. * A deadlock was detected.
  54. */
  55. public final static int XA_RBDEADLOCK = XA_RBBASE + 2;
  56. /**
  57. * A condition that violates the integrity of the resource was detected.
  58. */
  59. public final static int XA_RBINTEGRITY = XA_RBBASE + 3;
  60. /**
  61. * The resource manager rolled back the transaction branch for a reason
  62. * not on this list.
  63. */
  64. public final static int XA_RBOTHER = XA_RBBASE + 4;
  65. /**
  66. * A protocol error occured in the resource manager.
  67. */
  68. public final static int XA_RBPROTO = XA_RBBASE + 5;
  69. /**
  70. * A transaction branch took too long.
  71. */
  72. public final static int XA_RBTIMEOUT = XA_RBBASE + 6;
  73. /**
  74. * May retry the transaction branch.
  75. */
  76. public final static int XA_RBTRANSIENT = XA_RBBASE + 7;
  77. /**
  78. * The inclusive upper bound of the rollback error code.
  79. */
  80. public final static int XA_RBEND = XA_RBTRANSIENT;
  81. /**
  82. * Resumption must occur where suspension occured.
  83. */
  84. public final static int XA_NOMIGRATE = 9;
  85. /**
  86. * The transaction branch may have been heuristically completed.
  87. */
  88. public final static int XA_HEURHAZ = 8;
  89. /**
  90. * The transaction branch has been heuristically committed.
  91. */
  92. public final static int XA_HEURCOM = 7;
  93. /**
  94. * The transaction branch has been heuristically rolled back.
  95. */
  96. public final static int XA_HEURRB = 6;
  97. /**
  98. * The transaction branch has been heuristically committed and
  99. * rolled back.
  100. */
  101. public final static int XA_HEURMIX = 5;
  102. /**
  103. * Routine returned with no effect and may be reissued.
  104. */
  105. public final static int XA_RETRY = 4;
  106. /**
  107. * The transaction branch has been read-only and has been committed.
  108. */
  109. public final static int XA_RDONLY = 3;
  110. /**
  111. * Asynchronous operation already outstanding.
  112. */
  113. public final static int XAER_ASYNC = -2;
  114. /**
  115. * A resource manager error has occured in the transaction branch.
  116. */
  117. public final static int XAER_RMERR = -3;
  118. /**
  119. * The XID is not valid.
  120. */
  121. public final static int XAER_NOTA = -4;
  122. /**
  123. * Invalid arguments were given.
  124. */
  125. public final static int XAER_INVAL = -5;
  126. /**
  127. * Routine was invoked in an inproper context.
  128. */
  129. public final static int XAER_PROTO = -6;
  130. /**
  131. * Resource manager is unavailable.
  132. */
  133. public final static int XAER_RMFAIL = -7;
  134. /**
  135. * The XID already exists.
  136. */
  137. public final static int XAER_DUPID = -8;
  138. /**
  139. * The resource manager is doing work outside global transaction.
  140. */
  141. public final static int XAER_OUTSIDE = -9;
  142. }