1 22 package org.jboss.tm.remoting.interfaces; 23 24 import java.io.ObjectStreamException ; 25 import java.io.Serializable ; 26 27 34 public class Status implements Serializable 35 { 36 static final long serialVersionUID = -498123265225476852L; 37 38 43 private static final int MAX_TYPE_ID = 9; 44 45 46 private static final Status[] values = new Status[MAX_TYPE_ID + 1]; 47 48 public static final Status ACTIVE = new Status("ACTIVE", 0); 54 55 public static final Status MARKED_ROLLBACK = new Status("MARKED_ROLLBACK", 1); 56 57 public static final Status PREPARED = new Status("PREPARED", 2); 58 59 public static final Status COMMITTED = new Status("COMMITTED", 3); 60 61 public static final Status ROLLEDBACK = new Status("ROLLEDBACK", 4); 62 63 public static final Status UNKNOWN = new Status("UNKNOWN", 5); 64 65 public static final Status NO_TRANSACTION = new Status("NO_TRANSACTION", 6); 66 67 public static final Status PREPARING = new Status("PREPARING", 7); 68 69 public static final Status COMMITTING = new Status("COMMITTING", 8); 70 71 public static final Status ROLLINGBACK = new Status("ROLLINGBACK", 9); 72 73 private final transient String name; 74 75 private final int ordinal; 77 78 private Status(String name, int ordinal) 79 { 80 this.name = name; 81 this.ordinal = ordinal; 82 values[ordinal] = this; 83 } 84 85 public String toString() 86 { 87 return name; 88 } 89 90 public int toInteger() 91 { 92 return ordinal; 93 } 94 95 public static Status fromInteger(int i) 96 { 97 return values[i]; 98 } 99 100 Object readResolve() throws ObjectStreamException 101 { 102 return values[ordinal]; 103 } 104 105 } 106 | Popular Tags |