You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by co...@apache.org on 2010/09/07 00:07:28 UTC
svn commit: r993163 - in /openwebbeans/trunk:
webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Author: covener
Date: Mon Sep 6 22:07:27 2010
New Revision: 993163
URL: http://svn.apache.org/viewvc?rev=993163&view=rev
Log:
[OWB-446] defined-in-class (no-arg) EJB lifecycle callbacks were not
being properly run in the overall interceptor stack (they should be
suppressable by not calling our ic.proceed in a 299 interceptor,
and they should run in the same stack as the 299-defined interceptors)
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=993163&r1=993162&r2=993163&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java Mon Sep 6 22:07:27 2010
@@ -231,14 +231,13 @@ public class OpenWebBeansEjbInterceptor
{
InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
InterceptorUtil.getInterceptorMethods(injectionTarget.getInterceptorStack(), InterceptorType.POST_CONSTRUCT), InterceptorType.POST_CONSTRUCT);
+ impl.setEJBInvocationContext(context);
impl.setCreationalContext(threadLocalCreationalContext.get());
- // run OWB interceptors
+ // Call 299 interceptors, and if they all call proceed on OWB's invocationContext,
+ // do the same on the EJB containers context.
impl.proceed();
}
-
- // run EJB interceptors
- context.proceed();
}
catch (Exception e)
{
@@ -283,13 +282,13 @@ public class OpenWebBeansEjbInterceptor
{
InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
InterceptorUtil.getInterceptorMethods(injectionTarget.getInterceptorStack(),InterceptorType.PRE_DESTROY), InterceptorType.PRE_DESTROY);
+ impl.setEJBInvocationContext(context);
impl.setCreationalContext(threadLocalCreationalContext.get());
- // Call OWB interceptors
+ // Call 299 interceptors, and if they all call proceed on OWB's invocationContext,
+ // do the same on the EJB containers context.
impl.proceed();
}
- // Call EJB interceptors
- context.proceed();
}
catch (Exception e)
{
@@ -648,10 +647,13 @@ public class OpenWebBeansEjbInterceptor
InvocationContextImpl impl = new InvocationContextImpl(null, instance, null, null,
InterceptorUtil.getInterceptorMethods(interceptorStack, interceptorType), interceptorType);
+ impl.setEJBInvocationContext(ejbContext);
impl.setCreationalContext(localcc);
try
{
+ // Call 299 interceptors, and if they all call proceed on OWB's invocationContext,
+ // do the same on the EJB containers context.
impl.proceed();
}
catch (Exception e)
@@ -663,9 +665,6 @@ public class OpenWebBeansEjbInterceptor
{
logger.debug("No lifecycle interceptors for [{0}]", instance);
}
-
- //Call next interceptor
- ejbContext.proceed();
}
catch (Exception e)
{
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=993163&r1=993162&r2=993163&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Mon Sep 6 22:07:27 2010
@@ -321,7 +321,16 @@ public class InvocationContextImpl imple
}
}
-
+ else
+ {
+ /* For EJB's, we do not call the "in bean class" interceptors --the container does, and only if
+ * our last 299 interceptor called proceed (which takes us here).
+ */
+ if ((this.owbBean instanceof EnterpriseBeanMarker) && (this.ejbInvocationContext != null))
+ {
+ result = ejbInvocationContext.proceed();
+ }
+ }
return result;
}