1 22 package org.jboss.proxy.ejb; 23 24 import java.rmi.RemoteException ; 25 26 import javax.transaction.Transaction ; 27 28 import org.jboss.ejb.plugins.AbstractInterceptor; 29 import org.jboss.invocation.Invocation; 30 import org.jboss.metadata.MetaData; 31 32 39 public class NoTxPropagationInterceptor extends AbstractInterceptor 40 { 41 public Object invokeHome(Invocation mi) throws Exception 42 { 43 checkNoTxPropagation(mi); 44 return getNext().invokeHome(mi); 45 } 46 47 public Object invoke(Invocation mi) throws Exception 48 { 49 checkNoTxPropagation(mi); 50 return getNext().invoke(mi); 51 } 52 53 protected void checkNoTxPropagation(Invocation mi) throws Exception 54 { 55 if (mi.isLocal()) 57 return; 58 59 Transaction tx = mi.getTransaction(); 61 if (tx == null || (tx instanceof ForeignTransaction) == false) 62 return; 63 64 byte txType = container.getBeanMetaData().getTransactionMethod(mi.getMethod(), mi.getType()); 65 if (txType != MetaData.TX_NOT_SUPPORTED && txType != MetaData.TX_REQUIRES_NEW) 66 throw new RemoteException ("TxPropagation is not supported: " + container.getJmxName() + " method=" + mi.getMethod()); 67 68 mi.setTransaction(null); 70 } 71 } 72 | Popular Tags |