Author: rmannibucau Date: Thu May 9 21:14:26 2013 New Revision: 1480776 URL: http://svn.apache.org/r1480776 Log: caching constructorInjectionBean
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1480776&r1=1480775&r2=1480776&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java (original) +++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java Thu May 9 21:14:26 2013 @@ -101,6 +101,7 @@ public class BeanContext extends Deploym public static final String USER_INTERCEPTOR_SEPARATOR = ",| |;"; private boolean isPassivatingScope = true; + private ConstructorInjectionBean<Object> constructorInjectionBean = null; public boolean isDynamicallyImplemented() { return proxyClass != null; @@ -1573,7 +1574,18 @@ public class BeanContext extends Deploym } private ConstructorInjectionBean<Object> createConstructorInjectionBean(final WebBeansContext webBeansContext) { - return new ConstructorInjectionBean<Object>(webBeansContext, getManagedClass(), webBeansContext.getAnnotatedElementFactory().newAnnotatedType(getManagedClass())); + if (constructorInjectionBean != null) { + return constructorInjectionBean; + } + + synchronized (this) { // concurrentmodificationexception because of annotatedtype internals otherwise + if (constructorInjectionBean == null) { + constructorInjectionBean = new ConstructorInjectionBean<Object>( + webBeansContext, getManagedClass(), + webBeansContext.getAnnotatedElementFactory().newAnnotatedType(getManagedClass())); + } + } + return constructorInjectionBean; } @SuppressWarnings("unchecked")