1 45 package org.openejb.core.transaction; 46 47 import javax.ejb.EnterpriseBean ; 48 49 import org.openejb.ApplicationException; 50 51 73 public class TxNotSupported extends TransactionPolicy { 74 75 public TxNotSupported(TransactionContainer container){ 76 this(); 77 this.container = container; 78 } 79 80 public TxNotSupported(){ 81 policyType = NotSupported; 82 } 83 84 public String policyToString() { 85 return "TX_NotSupported: "; 86 } 87 88 public void beforeInvoke(EnterpriseBean instance, TransactionContext context) throws org.openejb.SystemException, org.openejb.ApplicationException{ 89 90 try { 91 context.clientTx = getTxMngr().suspend(); 93 } catch ( javax.transaction.SystemException se ) { 94 throw new org.openejb.SystemException(se); 95 } 96 context.currentTx = null; 97 98 } 99 100 public void afterInvoke(EnterpriseBean instance, TransactionContext context) throws org.openejb.ApplicationException, org.openejb.SystemException{ 101 102 if ( context.clientTx != null ) { 103 try{ 104 getTxMngr( ).resume( context.clientTx ); 105 }catch(javax.transaction.InvalidTransactionException ite){ 106 logger.error("Could not resume the client's transaction, the transaction is no longer valid: "+ite.getMessage()); 108 }catch(IllegalStateException e){ 109 logger.error("Could not resume the client's transaction: "+e.getMessage()); 111 }catch(javax.transaction.SystemException e){ 112 logger.error("Could not resume the client's transaction: The transaction reported a system exception: "+e.getMessage()); 114 } 115 } 116 } 117 118 119 135 public void handleApplicationException( Throwable appException, TransactionContext context) throws ApplicationException{ 136 throw new ApplicationException( appException ); 138 } 139 140 172 public void handleSystemException( Throwable sysException, EnterpriseBean instance, TransactionContext context) throws org.openejb.ApplicationException, org.openejb.SystemException{ 173 174 logSystemException( sysException ); 175 176 177 discardBeanInstance( instance, context.callContext); 178 179 180 throwExceptionToServer( sysException ); 181 } 182 183 } 184 185 | Popular Tags |