1 6 7 package org.jfox.tm; 8 9 import javax.transaction.HeuristicMixedException ; 10 import javax.transaction.HeuristicRollbackException ; 11 import javax.transaction.NotSupportedException ; 12 import javax.transaction.RollbackException ; 13 import javax.transaction.SystemException ; 14 import javax.transaction.UserTransaction ; 15 16 24 25 public class ServerUserTransaction implements UserTransaction { 26 private static ServerUserTransaction me = null; 27 private static TxManager tm = null; 28 29 private ServerUserTransaction() { 30 tm = TxManager.getInstance(); 31 } 32 33 public static ServerUserTransaction getInstance() { 34 if(me == null) { 36 me = new ServerUserTransaction(); 37 } 38 return me; 39 } 40 41 public void begin() throws NotSupportedException , SystemException { 42 tm.begin(); 43 } 44 45 public void commit() throws RollbackException , HeuristicMixedException , HeuristicRollbackException , SecurityException , IllegalStateException , SystemException { 46 tm.commit(); 47 } 48 49 public void rollback() throws IllegalStateException , SecurityException , SystemException { 50 tm.rollback(); 51 } 52 53 public void setRollbackOnly() throws IllegalStateException , SystemException { 54 tm.setRollbackOnly(); 55 } 56 57 public int getStatus() throws SystemException { 58 return tm.getStatus(); 59 } 60 61 public void setTransactionTimeout(int timeout) throws SystemException { 62 tm.setTransactionTimeout(timeout); 63 } 64 65 public int getNumTransactions() { 66 return tm.getNumTransactions(); 67 } 68 69 public int getNumSuspendedTransactions() { 70 return tm.getNumSuspendedTransactions(); 71 } 72 73 public static void main(String [] args) { 74 75 } 76 } 77 78 | Popular Tags |