tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1443537 - /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
Date Thu, 07 Feb 2013 15:12:06 GMT
Author: rmannibucau
Date: Thu Feb  7 15:12:06 2013
New Revision: 1443537

URL: http://svn.apache.org/viewvc?rev=1443537&view=rev
Log:
don't validate passivation for ejb which are not stateful - a lookup doesn't care

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java?rev=1443537&r1=1443536&r2=1443537&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java
Thu Feb  7 15:12:06 2013
@@ -70,10 +70,14 @@ public class CdiEjbBean<T> extends BaseE
         passivatingId = beanContext.getDeploymentID() + getReturnType().getName();
     }
 
-    @Override // copied to be able to produce EM (should be fixed in OWB for next CDI spec)
+    @Override
     public void validatePassivationDependencies() {
-        // if(isPassivationCapable()) {
-        if(getWebBeansContext().getBeanManagerImpl().isPassivatingScope(getScope())) { //
not @Dependent otherwise we either can't inject EJB in serializable beans or the opposite
+        if (!BeanType.STATEFUL.equals(beanContext.getComponentType())) { // always serializable
since we redo a lookup
+            return;
+        }
+
+        final Class<? extends Annotation> scope = getScope();
+        if(getWebBeansContext().getBeanManagerImpl().isPassivatingScope(scope)) { // not
@Dependent otherwise we either can't inject EJB in serializable beans or the opposite
             final Set<InjectionPoint> beanInjectionPoints = getInjectionPoints();
             for(InjectionPoint injectionPoint : beanInjectionPoints) {
                 if(!injectionPoint.isTransient()) {
@@ -107,12 +111,12 @@ public class CdiEjbBean<T> extends BaseE
         for (InterceptorData interceptorData : interceptorStack) {
             if (interceptorData.isDefinedWithWebBeansInterceptor()) {
                 WebBeansInterceptor<?> interceptor = (WebBeansInterceptor<?>)
interceptorData.getWebBeansInterceptor();
-                if (!interceptor.isPassivationCapable()) {
-                    throw new WebBeansConfigurationException(MessageFormat.format(
-                            WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0016),
toString()));
-                } else {
-                    interceptor.validatePassivationDependencies();
-                }
+                    if (!interceptor.isPassivationCapable()) {
+                        throw new WebBeansConfigurationException(MessageFormat.format(
+                                WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0016),
toString()));
+                    } else {
+                        interceptor.validatePassivationDependencies();
+                    }
             } else {
                 if (interceptorData.isDefinedInInterceptorClass()) {
                     Class<?> interceptorClass = interceptorData.getInterceptorClass();



Mime
View raw message