1 45 package org.openejb.core.transaction; 46 47 import javax.ejb.EnterpriseBean ; 48 49 import org.openejb.ApplicationException; 50 51 72 public class TxSupports extends TransactionPolicy { 73 74 public TxSupports(TransactionContainer container){ 75 this(); 76 this.container = container; 77 } 78 79 public TxSupports(){ 80 policyType = Supports; 81 } 82 83 public String policyToString() { 84 return "TX_Supports: "; 85 } 86 87 public void beforeInvoke(EnterpriseBean instance, TransactionContext context) throws org.openejb.SystemException, org.openejb.ApplicationException{ 88 89 try { 90 91 context.clientTx = getTxMngr().getTransaction(); 92 context.currentTx = context.clientTx; 93 94 } catch ( javax.transaction.SystemException se ) { 95 throw new org.openejb.SystemException(se); 96 } 97 } 98 99 public void afterInvoke(EnterpriseBean instance, TransactionContext context) throws org.openejb.ApplicationException, org.openejb.SystemException{ 100 101 } 102 103 118 public void handleApplicationException( Throwable appException, TransactionContext context) throws ApplicationException{ 119 throw new ApplicationException( appException ); 121 } 122 123 158 public void handleSystemException( Throwable sysException, EnterpriseBean instance, TransactionContext context) throws org.openejb.ApplicationException, org.openejb.SystemException{ 159 160 161 boolean runningInTransaction = ( context.currentTx != null ); 162 163 if (runningInTransaction) { 164 165 logSystemException( sysException ); 166 167 168 markTxRollbackOnly( context.currentTx ); 169 170 171 discardBeanInstance(instance, context.callContext); 172 173 174 throwTxExceptionToServer( sysException ); 175 176 } else { 177 178 logSystemException( sysException ); 179 180 181 discardBeanInstance( instance, context.callContext); 182 183 184 throwExceptionToServer( sysException ); 185 } 186 187 } 188 189 } 190 191 | Popular Tags |