[jboss-cvs] JBossAS SVN: r110566 - in projects/ejb3/branches/jboss-ejb3-core-1.3/src/main: java/org/jboss/ejb3/mdb and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 9 09:03:37 EST 2011


Author: jaikiran
Date: 2011-02-09 09:03:37 -0500 (Wed, 09 Feb 2011)
New Revision: 110566

Modified:
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
   projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/resources/ejb3-interceptors-aop.xml
Log:
JBPAPP-4633 Port the fix for EJBTHREE-2125 to jboss-ejb3-core 1.3 branch

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/EJBContainer.java	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/EJBContainer.java	2011-02-09 14:03:37 UTC (rev 110566)
@@ -21,14 +21,60 @@
  */
 package org.jboss.ejb3;
 
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.LinkRef;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
 import org.jboss.aop.Advisor;
 import org.jboss.aop.Domain;
 import org.jboss.aop.MethodInfo;
 import org.jboss.aop.advice.AdviceStack;
 import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.advice.PerVmAdvice;
 import org.jboss.aop.annotation.AnnotationRepository;
+import org.jboss.aop.joinpoint.Joinpoint;
 import org.jboss.aop.microcontainer.annotations.DisableAOP;
 import org.jboss.aop.util.MethodHashing;
+import org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor;
 import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.ejb.AllowedOperationsAssociation;
 import org.jboss.ejb3.annotation.Clustered;
@@ -41,6 +87,7 @@
 import org.jboss.ejb3.injection.InjectionInvocation;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
 import org.jboss.ejb3.interceptor.InterceptorInjector;
+import org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor;
 import org.jboss.ejb3.interceptors.container.ManagedObjectAdvisor;
 import org.jboss.ejb3.interceptors.direct.DirectContainer;
 import org.jboss.ejb3.interceptors.direct.IndirectContainer;
@@ -93,42 +140,6 @@
 import org.jboss.util.StringPropertyReplacer;
 import org.jboss.util.naming.Util;
 
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.EJBException;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Timeout;
-import javax.ejb.Timer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.LinkRef;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.transaction.TransactionManager;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-
 /**
  * Comment
  *
@@ -955,7 +966,6 @@
       }
       bindORB();
       bindEJBContext();
-      
       /*
       initializeClassContainer();
       for (int i = 0; i < constructors.length; i++)
@@ -1853,4 +1863,87 @@
          this.semaphore.release();
       }
    }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public EJBHome getEJBHome() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public EJBLocalHome getEJBLocalHome() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean getRollbackOnly() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public UserTransaction getUserTransaction() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public boolean isCallerInRole(Principal callerPrincipal, String roleName) throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public Object lookup(String name) throws IllegalArgumentException
+   {
+      try
+      {
+         Object obj = this.getEnc().lookup(name);
+         return obj;
+      }
+      catch (NamingException ne)
+      {
+         throw new RuntimeException(ne);
+      }
+   }
+
+   /**
+    * {@inheritDoc} 
+    */
+   public void setRollbackOnly() throws IllegalStateException
+   {
+      throw new UnsupportedOperationException("NYI");
+   }
+   
+   /**
+    * 
+    * @param joinPoint
+    * @param interceptorStackName
+    * @return
+    */
+   protected Interceptor[] getInterceptors(Joinpoint joinPoint, String interceptorStackName)
+   {
+      AdviceStack stack = this.getAdvisor().getManager().getAdviceStack(interceptorStackName);
+      if (stack == null)
+      {
+         log.debug("No AOP interceptor stack with name : " + interceptorStackName + " available for EJB container: " + this);
+         return new Interceptor[0];
+      }
+      List<Interceptor> interceptors = new ArrayList<Interceptor>();
+      interceptors.addAll(Arrays.asList(stack.createInterceptors(this.getAdvisor(), joinPoint)));
+      return interceptors.toArray(new Interceptor[]{});
+   }
 }

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessageContainerInvocation.java	2011-02-09 14:03:37 UTC (rev 110566)
@@ -22,10 +22,13 @@
 package org.jboss.ejb3.mdb;
 
 import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.EJBContainerInvocation;
 import org.jboss.ejb3.context.spi.InvocationContext;
 import org.jboss.ejb3.core.context.InvocationContextAdapter;
+import org.jboss.ejb3.session.SessionContainerInvocation;
 
 /**
  * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
@@ -39,6 +42,25 @@
       super(info);
       this.invocationContext = new InvocationContextAdapter(this);
    }
+   
+   /**
+    * /**
+    * Creates a {@link MessageContainerInvocation}.
+    * <p>
+    *   This constructor is similar to {@link #MessageContainerInvocation(MethodInfo)} except that this
+    *   constructor overwrites the interceptors for this {@link Invocation} with the passed <code>interceptors</code>.
+    *   This effectively, ignores the interceptors available from {@link MethodInfo#getInterceptors()} 
+    * </p>
+    * 
+    * @param info The {@link MethodInfo}
+    * @param interceptors The interceptors which will be used by this {@link Invocation}. 
+    */
+   public MessageContainerInvocation(MethodInfo info, Interceptor[] interceptors)
+   {
+      this (info);
+      this.interceptors = interceptors;
+   }
+   
 
    public InvocationContext getInvocationContext()
    {

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/mdb/MessagingContainer.java	2011-02-09 14:03:37 UTC (rev 110566)
@@ -21,6 +21,7 @@
  */
 package org.jboss.ejb3.mdb;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Hashtable;
 import java.util.Map;
@@ -38,6 +39,7 @@
 
 import org.jboss.aop.Domain;
 import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.EJBContainerInvocation;
@@ -45,9 +47,11 @@
 import org.jboss.ejb3.Ejb3Module;
 import org.jboss.ejb3.TimerServiceContainer;
 import org.jboss.ejb3.annotation.ResourceAdapter;
+import org.jboss.ejb3.context.spi.MessageDrivenBeanManager;
 import org.jboss.ejb3.jms.JMSDestinationFactory;
 import org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
+import org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker;
 import org.jboss.ejb3.timerservice.spi.TimedObjectInvoker;
 import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.logging.Logger;
@@ -59,11 +63,14 @@
  * @version <tt>$Revision$</tt>
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
  */
-public abstract class MessagingContainer extends TimerServiceContainer implements TimedObjectInvoker
+public abstract class MessagingContainer extends TimerServiceContainer implements MultiTimeoutMethodTimedObjectInvoker, MessageDrivenBeanManager
 {
    private static final Logger log = Logger.getLogger(MessagingContainer.class);
    
    private Method timeout;
+   
+   private static final String MDB_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME = "MessageDrivenBeanTimeoutMethodStack";
+   
    protected ActivationSpec activationSpec = new ActivationSpec();
    protected JBossMessageEndpointFactory messageEndpointFactory;
    private MessagingDelegateWrapper mbean = new MessagingDelegateWrapper(this);
@@ -280,22 +287,13 @@
       }
    }
 
-   
+   @Override
    public void callTimeout(Timer timer) throws Exception
    {
+      // the method annotated with @Timeout or it's xml equivalent
       if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
-      Object[] args = {timer};
-      if(timeout.getParameterTypes().length == 0)
-         args = null;
-      try
-      {
-         localInvoke(timeout, args);
-      }
-      catch (Throwable throwable)
-      {
-         if (throwable instanceof Exception) throw (Exception) throwable;
-         throw new RuntimeException(throwable);
-      }
+      // call the timeout method
+      this.callTimeout(timer, this.timeout);
    }
 
    @Override
@@ -639,4 +637,47 @@
       return this;
    }
    
+   /**
+    * Invokes the passed timeout method for the passed {@link Timer}, on a bean instance.
+    * 
+    * @param timer The {@link Timer} for which the timeout has occurred 
+    * @param tMethod The timeout method
+    * @throws Exception If any exception occurs during invocation of timeout method on the target bean
+    * @throws {@link NullPointerException} If the passed <code>tMethod</code> is null
+    */
+   @Override
+   public void callTimeout(Timer timer, Method tMethod) throws Exception
+   {
+      Object[] args = {timer};
+      if(tMethod.getParameterTypes().length == 0)
+         args = null;
+
+      MethodInfo info = getMethodInfo(tMethod);
+      if (info == null)
+      {
+         throw new RuntimeException("Could not find timeout method info: " + tMethod.toString() + " for container " + this);
+      }
+      // get hold of the unadvised method, so that we can mark it accessible
+      // for the duration of this call (Remember, timeout methods can be with private, protected, package access modifier)
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      // mark as accessible before invoking
+      unadvisedMethod.setAccessible(true);
+      try
+      {
+         // the timeout method (even if private, protected etc...) should pass through the AOP interceptor
+         // chain. Hence we have a specific AOP interceptor stack for timeout method. Get hold of those interceptors
+         Interceptor[] timeoutMethodAOPInterceptors = this.getInterceptors(info.getJoinpoint(),MDB_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME);
+         // now create an invocation for the method info and the timeout method interceptors         
+         EJBContainerInvocation nextInvocation = new MessageContainerInvocation(info, timeoutMethodAOPInterceptors);
+         nextInvocation.setAdvisor(getAdvisor());
+         nextInvocation.setArguments(args);
+         nextInvocation.invokeNext();
+      }
+      catch (Throwable throwable)
+      {
+         if (throwable instanceof Exception) throw (Exception) throwable;
+         throw new RuntimeException(throwable);
+      }
+      
+   }
 }
\ No newline at end of file

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/session/SessionContainerInvocation.java	2011-02-09 14:03:37 UTC (rev 110566)
@@ -22,6 +22,8 @@
 package org.jboss.ejb3.session;
 
 import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.EJBContainerInvocation;
 import org.jboss.ejb3.context.spi.SessionInvocationContext;
@@ -39,7 +41,26 @@
       super(info);
       this.invocationContext = new SessionInvocationContextAdapter(invokedBusinessInterface, this);
    }
+   
+   /**
+    * Creates a {@link SessionContainerInvocation}.
+    * <p>
+    *   This constructor is similar to {@link #SessionContainerInvocation(Class, MethodInfo)} except that this
+    *   constructor overwrites the interceptors for this {@link Invocation} with the passed <code>interceptors</code>.
+    *   This effectively, ignores the interceptors available from {@link MethodInfo#getInterceptors()} 
+    * </p>
+    * 
+    * @param invokedBusinessInterface The invoked business interface
+    * @param info The {@link MethodInfo}
+    * @param interceptors The interceptors which will be used by this {@link Invocation}. 
+    */
+   public SessionContainerInvocation(Class<?> invokedBusinessInterface, MethodInfo info, Interceptor[] interceptors)
+   {
+      this(invokedBusinessInterface, info);
+      this.interceptors = interceptors;
+   }
 
+
    public SessionInvocationContext getInvocationContext()
    {
       return invocationContext;

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2011-02-09 14:03:37 UTC (rev 110566)
@@ -36,16 +36,15 @@
 import javax.ejb.Handle;
 import javax.ejb.RemoteHome;
 import javax.ejb.Timer;
-import javax.ejb.TimerService;
 import javax.naming.NamingException;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.Domain;
 import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.InvocationResponse;
 import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.ejb.AllowedOperationsAssociation;
 import org.jboss.ejb.AllowedOperationsFlags;
 import org.jboss.ejb3.BeanContext;
@@ -72,8 +71,8 @@
 import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.ejb3.session.SessionContainerInvocation;
 import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.timerservice.spi.MultiTimeoutMethodTimedObjectInvoker;
 import org.jboss.ejb3.timerservice.spi.TimedObjectInvoker;
-import org.jboss.ejb3.timerservice.spi.TimerServiceFactory;
 import org.jboss.ejb3.util.CollectionHelper;
 import org.jboss.injection.WebServiceContextProxy;
 import org.jboss.injection.lang.reflect.BeanProperty;
@@ -99,11 +98,14 @@
  * @version $Revision$
  */
 public class StatelessContainer extends SessionSpecContainer
-  implements TimedObjectInvoker, ServiceEndpointContainer, InvokableContext
+  implements MultiTimeoutMethodTimedObjectInvoker, ServiceEndpointContainer, InvokableContext
 {
    private static final Logger log = Logger.getLogger(StatelessContainer.class);
 
    private Method timeout;
+   
+   private static final String SLSB_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME = "StatelessBeanTimeoutMethodStack";
+
    private StatelessDelegateWrapper mbean = new StatelessDelegateWrapper(this);
 
    public StatelessContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
@@ -184,39 +186,17 @@
       this.timeout = getTimeoutCallback(timeoutMethodMetaData, getBeanClass());
    }
    
-   
+   /**
+    * {@inheritDoc}
+    */
+   @Override
    public void callTimeout(Timer timer) throws Exception
    {
+      // the method annotated with @Timeout or it's xml equivalent
       if (timeout == null) throw new EJBException("No method has been annotated with @Timeout");
-      Object[] args = {timer};
-      if(timeout.getParameterTypes().length == 0)
-         args = null;      
-      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
-         try
-         {
-            MethodInfo info = super.getMethodInfo(timeout);
-            EJBContainerInvocation nextInvocation = new SessionContainerInvocation(null, info);
-            nextInvocation.setAdvisor(getAdvisor());
-            nextInvocation.setArguments(args);
-            nextInvocation.invokeNext();
-         }
-         catch (Throwable throwable)
-         {
-            if (throwable instanceof Exception) throw (Exception) throwable;
-            throw new RuntimeException(throwable);
-         }
-         finally
-         {
-            AllowedOperationsAssociation.popInMethodFlag();
-         }
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(oldLoader);
-      }
+      
+      // call the timeout method
+      this.callTimeout(timer, timeout);
    }
 
    /**
@@ -661,6 +641,65 @@
       return this;
    }
    
+   /**
+    * Invokes the passed timeout method for the passed {@link Timer}, on a bean instance.
+    * 
+    * @param timer The {@link Timer} for which the timeout has occurred 
+    * @param tMethod The timeout method
+    * @throws Exception If any exception occurs during invocation of timeout method on the target bean
+    * @throws {@link NullPointerException} If the passed <code>tMethod</code> is null
+    */
+   @Override
+   public void callTimeout(Timer timer, Method tMethod) throws Exception
+   {
+      Object[] args =
+      {timer};
+      if (tMethod.getParameterTypes().length == 0)
+         args = null;
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+
+      try
+      {
+         AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
+
+         // get the method info (AOP stuff)
+         MethodInfo info = super.getMethodInfo(tMethod);
+         // get hold of the unadvised method, so that we can mark it accessible
+         // for the duration of this call (Remember, timeout methods can be with private, protected, package access modifier)
+         Method unadvisedMethod = info.getUnadvisedMethod();
+         // mark as accessible before invoking
+         unadvisedMethod.setAccessible(true);
+
+         try
+         {
+            // the timeout method (even if private, protected etc...) should pass through the AOP interceptor
+            // chain. Hence we have a specific AOP interceptor stack for timeout method. Get hold of those interceptors
+            Interceptor[] timeoutMethodAOPInterceptors = this.getInterceptors(info.getJoinpoint(),SLSB_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME);
+            // now create an invocation for the method info and the timeout method interceptors
+            EJBContainerInvocation nextInvocation = new SessionContainerInvocation(null, info, timeoutMethodAOPInterceptors);
+            nextInvocation.setAdvisor(getAdvisor());
+            nextInvocation.setArguments(args);
+            nextInvocation.invokeNext();
+         }
+         catch (Throwable throwable)
+         {
+            if (throwable instanceof Exception)
+               throw (Exception) throwable;
+            throw new RuntimeException(throwable);
+         }
+         finally
+         {
+            AllowedOperationsAssociation.popInMethodFlag();
+
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+      }
+   }
+   
+   
    static class WSCallbackImpl implements BeanContextLifecycleCallback
    {
       private ExtensibleWebServiceContext jaxwsContext;

Modified: projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/resources/ejb3-interceptors-aop.xml
===================================================================
--- projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/resources/ejb3-interceptors-aop.xml	2011-02-09 13:05:56 UTC (rev 110565)
+++ projects/ejb3/branches/jboss-ejb3-core-1.3/src/main/resources/ejb3-interceptors-aop.xml	2011-02-09 14:03:37 UTC (rev 110566)
@@ -146,6 +146,13 @@
          <advice name="setup" aspect="InvocationContextInterceptor"/>
          <interceptor-ref name="CurrentInvocationContextInterceptor"/>
       </stack>
+      
+      <stack name="TimeoutMethodStack">
+        <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
+        <interceptor-ref name="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor"/>
+        <interceptor-ref name="CurrentInvocationContextInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.BlockContainerShutdownInterceptor"/>
+      </stack>
    </domain>
 
 
@@ -177,6 +184,30 @@
       <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
          @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000)
       </annotation>
+      
+            
+      <stack name="StatelessBeanTimeoutMethodStack">
+
+      	<!--  Include the common timeout method stack
+      		After JBAS-8130, just use this stack-ref and remove the 4 duplicate listed interceptor-refs
+      		below 
+      	<stack-ref name="TimeoutMethodStack"/> -->
+
+      	<interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
+        <interceptor-ref name="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor"/>
+        <interceptor-ref name="CurrentInvocationContextInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.BlockContainerShutdownInterceptor"/>
+
+      	<!--  The additional SLSB specific ones -->
+		<interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+        <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+        <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+        <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+      </stack>
+      
    </domain>
 
    <domain name="JACC Stateless Bean" extends="Intercepted Bean" inheritBindings="true">
@@ -375,6 +406,30 @@
       <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
          @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
       </annotation>
+      
+      <stack name="MessageDrivenBeanTimeoutMethodStack">
+
+      	<!--  Include the common timeout method stack
+      		After JBAS-8130, just use this stack-ref and remove the 4 duplicate listed interceptor-refs
+      		below 
+      	<stack-ref name="TimeoutMethodStack"/>
+      	-->
+      	<interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
+        <interceptor-ref name="org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor"/>
+        <interceptor-ref name="CurrentInvocationContextInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.BlockContainerShutdownInterceptor"/>
+
+		<!--  The additional MDB specific ones -->
+		<interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
+        <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
+        <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+        <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+         
+      	         
+      </stack>
+      
    </domain>
 
    <domain name="Consumer Bean" extends="Intercepted Bean" inheritBindings="true">



More information about the jboss-cvs-commits mailing list