1 16 17 package org.springframework.transaction; 18 19 27 public class HeuristicCompletionException extends TransactionException { 28 29 32 public static final int STATE_UNKNOWN = 0; 33 public static final int STATE_COMMITTED = 1; 34 public static final int STATE_ROLLED_BACK = 2; 35 public static final int STATE_MIXED = 3; 36 37 38 public static String getStateString(int state) { 39 switch (state) { 40 case STATE_COMMITTED: 41 return "committed"; 42 case STATE_ROLLED_BACK: 43 return "rolled back"; 44 case STATE_MIXED: 45 return "mixed"; 46 default: 47 return "unknown"; 48 } 49 } 50 51 52 55 private int outcomeState = STATE_UNKNOWN; 56 57 58 63 public HeuristicCompletionException(int outcomeState, Throwable cause) { 64 super("Heuristic completion: outcome state is " + getStateString(outcomeState), cause); 65 this.outcomeState = outcomeState; 66 } 67 68 76 public int getOutcomeState() { 77 return outcomeState; 78 } 79 80 } 81 | Popular Tags |