1 package org.jboss.cache.transaction; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 6 import javax.transaction.HeuristicMixedException ; 7 import javax.transaction.HeuristicRollbackException ; 8 import javax.transaction.NotSupportedException ; 9 import javax.transaction.RollbackException ; 10 import javax.transaction.Status ; 11 import javax.transaction.Synchronization ; 12 import javax.transaction.SystemException ; 13 import javax.transaction.UserTransaction ; 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 23 public class DummyUserTransaction implements UserTransaction , java.io.Serializable 24 { 25 int status = Status.STATUS_UNKNOWN; 26 static final Log logger_ = LogFactory.getLog(DummyUserTransaction.class); 27 DummyTransactionManager tm_; 28 private static final long serialVersionUID = -6568400755677046127L; 29 30 33 List <Synchronization > l = new ArrayList <Synchronization >(); 34 35 public DummyUserTransaction(DummyTransactionManager tm) 36 { 37 tm_ = tm; 38 } 39 40 41 50 public void begin() throws NotSupportedException , SystemException 51 { 52 tm_.begin(); 53 status = Status.STATUS_ACTIVE; 54 } 55 56 72 public void commit() 73 throws RollbackException , HeuristicMixedException , 74 HeuristicRollbackException , SecurityException , SystemException 75 { 76 77 tm_.commit(); 78 status = Status.STATUS_COMMITTED; 79 } 80 81 91 public void rollback() throws IllegalStateException , SystemException 92 { 93 tm_.rollback(); 94 status = Status.STATUS_ROLLEDBACK; 95 } 96 97 105 public void setRollbackOnly() throws IllegalStateException , SystemException 106 { 107 tm_.setRollbackOnly(); 108 } 109 110 118 public int getStatus() throws SystemException 119 { 120 return tm_.getStatus(); 121 } 122 123 133 public void setTransactionTimeout(int seconds) throws SystemException 134 { 135 throw new SystemException ("not supported"); 136 } 137 138 } 139 | Popular Tags |