1 25 26 package org.objectweb.easybeans.transaction.interceptors; 27 28 import javax.ejb.EJBException ; 29 import javax.transaction.SystemException ; 30 import javax.transaction.Transaction ; 31 32 import org.objectweb.easybeans.api.EasyBeansInvocationContext; 33 import org.objectweb.easybeans.log.JLog; 34 import org.objectweb.easybeans.log.JLogFactory; 35 36 40 public class CMTNeverTransactionInterceptor extends AbsTransactionInterceptor { 41 42 45 private JLog logger = JLogFactory.getLog(CMTNeverTransactionInterceptor.class); 46 47 51 public CMTNeverTransactionInterceptor() { 52 super(); 53 } 54 55 64 @Override 65 public Object intercept(final EasyBeansInvocationContext invocationContext) throws Exception { 66 logger.debug("Calling Never TX interceptor"); 67 68 Transaction transaction; 70 try { 71 transaction = getTransactionManager().getTransaction(); 72 } catch (SystemException se) { 73 throw new EJBException ("Cannot get the current transaction on transaction manager.", se); 74 } 75 76 logger.debug("Transaction found = {0}", transaction); 77 78 85 if (transaction != null) { 86 logger.warn("Mandatory as transaction attribute but within a transaction."); 87 throw new EJBException ("Client should not call within a transaction context by using NEVER mode."); 88 } 89 94 try { 95 return invocationContext.proceed(); 96 } catch (Exception e) { 97 handleUnspecifiedTransactionContext(invocationContext, e); 98 return null; 100 } 101 } 102 103 } 104 | Popular Tags |