openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1629479 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/intercept/ main/java/org/apache/webbeans/util/ test/java/org/apache/webbeans/test/component/decorator/clean/ test/java/org/apache/webbeans/test/component/eve...
Date Sun, 05 Oct 2014 09:09:45 GMT
Author: struberg
Date: Sun Oct  5 09:09:44 2014
New Revision: 1629479

URL: http://svn.apache.org/r1629479
Log:
OWB-1020 take class level interceptors if there is no own method interceptor.

This speeds up scanning of classes with interceptors and also reduces the memory footprint

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/performance/StartupPerformanceTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Sun Oct  5 09:09:44 2014
@@ -109,9 +109,21 @@ public class InterceptorResolutionServic
             decorators = Collections.emptyList(); // less to store
         }
 
+        Set<Interceptor<?>> allUsedCdiInterceptors = new HashSet<Interceptor<?>>();
+
         // pick up CDI interceptors from a class level
         Set<Annotation> classInterceptorBindings = annotationManager.getInterceptorAnnotations(annotatedType.getAnnotations());
-        Set<Interceptor<?>> allUsedCdiInterceptors = new HashSet<Interceptor<?>>();
+        List<Interceptor<?>> classLevelInterceptors;
+        if (classInterceptorBindings.size() > 0)
+        {
+            classLevelInterceptors = webBeansContext.getBeanManagerImpl().resolveInterceptors(InterceptionType.AROUND_INVOKE,
AnnotationUtil.asArray(classInterceptorBindings));
+            allUsedCdiInterceptors.addAll(classLevelInterceptors);
+        }
+        else
+        {
+            classLevelInterceptors = Collections.EMPTY_LIST;
+        }
+
         Set<Interceptor<?>> allUsedConstructorCdiInterceptors = new HashSet<Interceptor<?>>();
         addCdiClassLifecycleInterceptors(annotatedType, classInterceptorBindings, allUsedCdiInterceptors,
allUsedConstructorCdiInterceptors);
 
@@ -132,7 +144,8 @@ public class InterceptorResolutionServic
 
             calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors,
classLevelEjbInterceptors, annotatedMethod);
 
-            calculateCdiMethodInterceptors(methodInterceptorInfo, InterceptionType.AROUND_INVOKE,
allUsedCdiInterceptors, annotatedMethod, classInterceptorBindings);
+            calculateCdiMethodInterceptors(methodInterceptorInfo, InterceptionType.AROUND_INVOKE,
allUsedCdiInterceptors, annotatedMethod,
+                                           classInterceptorBindings, classLevelInterceptors);
 
             calculateCdiMethodDecorators(methodInterceptorInfo, decorators, annotatedMethod);
 
@@ -359,7 +372,7 @@ public class InterceptorResolutionServic
                 foundMethods.add(lifecycleMethod);
                 calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors,
classLevelEjbInterceptors, lifecycleMethod);
 
-                calculateCdiMethodInterceptors(methodInterceptorInfo, interceptionType, allUsedCdiInterceptors,
lifecycleMethod, classInterceptorBindings);
+                calculateCdiMethodInterceptors(methodInterceptorInfo, interceptionType, allUsedCdiInterceptors,
lifecycleMethod, classInterceptorBindings, null);
             }
         }
         for (AnnotatedConstructor<?> lifecycleMethod : annotatedType.getConstructors())
@@ -367,7 +380,7 @@ public class InterceptorResolutionServic
             // TODO: verifyLifecycleMethod(lifeycleAnnotation, lifecycleMethod);
             calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors,
classLevelEjbInterceptors, lifecycleMethod);
 
-            calculateCdiMethodInterceptors(methodInterceptorInfo, interceptionType, allUsedCdiInterceptors,
lifecycleMethod, classInterceptorBindings);
+            calculateCdiMethodInterceptors(methodInterceptorInfo, interceptionType, allUsedCdiInterceptors,
lifecycleMethod, classInterceptorBindings, null);
         }
 
         if (foundMethods.size() > 0 )
@@ -573,19 +586,22 @@ public class InterceptorResolutionServic
                                                 InterceptionType interceptionType,
                                                 Set<Interceptor<?>> allUsedCdiInterceptors,
                                                 AnnotatedCallable annotatedMethod,
-                                                Set<Annotation> classInterceptorBindings)
+                                                Set<Annotation> classInterceptorBindings,
+                                                List<Interceptor<?>> classLevelInterceptors)
     {
         AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
 
         boolean unproxyable = isUnproxyable(annotatedMethod);
+        boolean hasMethodInterceptors = false;
 
         Map<Class<? extends Annotation>, Annotation> cummulatedInterceptorBindings
= new HashMap<Class<? extends Annotation>, Annotation>();
         for (Annotation interceptorBinding: annotationManager.getInterceptorAnnotations(annotatedMethod.getAnnotations()))
         {
             cummulatedInterceptorBindings.put(interceptorBinding.annotationType(), interceptorBinding);
+            hasMethodInterceptors = true;
         }
 
-        if (unproxyable && cummulatedInterceptorBindings.size() > 0)
+        if (unproxyable && hasMethodInterceptors)
         {
             throw new WebBeansConfigurationException(annotatedMethod + " is not proxyable,
but an Interceptor got defined on it!");
         }
@@ -609,12 +625,20 @@ public class InterceptorResolutionServic
             return;
         }
 
-        List<Interceptor<?>> methodInterceptors
-                = webBeansContext.getBeanManagerImpl().resolveInterceptors(interceptionType,
AnnotationUtil.asArray(cummulatedInterceptorBindings.values()));
 
-        methodInterceptorInfo.setCdiInterceptors(methodInterceptors);
+        List<Interceptor<?>> methodInterceptors;
+        if (hasMethodInterceptors || classLevelInterceptors == null)
+        {
+            methodInterceptors = webBeansContext.getBeanManagerImpl().resolveInterceptors(interceptionType,
AnnotationUtil.asArray(cummulatedInterceptorBindings.values()));
+            allUsedCdiInterceptors.addAll(methodInterceptors);
+        }
+        else
+        {
+            // if there is no explicit interceptor defined on the method, then we just take
all the interceptors from the class
+            methodInterceptors = classLevelInterceptors;
+        }
 
-        allUsedCdiInterceptors.addAll(methodInterceptors);
+        methodInterceptorInfo.setCdiInterceptors(methodInterceptors);
     }
 
     /**
@@ -630,34 +654,35 @@ public class InterceptorResolutionServic
     private <T> void verifyLifecycleMethod(Class<? extends Annotation> lifecycleAnnotation,
AnnotatedMethod<T> annotatedMethod)
     {
         List<AnnotatedParameter<T>> params = annotatedMethod.getParameters();
+        Method method = annotatedMethod.getJavaMember();
         if (params.size() > 0 && (params.size() > 1 || !params.get(0).getBaseType().equals(InvocationContext.class)))
         {
             throw new WebBeansConfigurationException(lifecycleAnnotation.getName() + " LifecycleMethod
"
-                                                     + annotatedMethod.getJavaMember()
+                                                     + method
                                                      + " must either have no parameter or
InvocationContext but has:"
-                                                     + Arrays.toString(annotatedMethod.getJavaMember().getParameterTypes()));
+                                                     + Arrays.toString(method.getParameterTypes()));
         }
 
-        if (!annotatedMethod.getJavaMember().getReturnType().equals(Void.TYPE))
+        if (!method.getReturnType().equals(Void.TYPE))
         {
             throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
-                    + " annotated method : " + annotatedMethod.getJavaMember().getName()
+                    + " annotated method : " + method.getName()
                     + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
                     + " must return void type");
         }
 
-        if (isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(annotatedMethod.getJavaMember()))
+        if (isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(method))
         {
             throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
-                    + " annotated method : " + annotatedMethod.getJavaMember().getName()
+                    + " annotated method : " + method.getName()
                     + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
                     + " can not throw any checked exception");
         }
 
-        if (Modifier.isStatic(annotatedMethod.getJavaMember().getModifiers()))
+        if (Modifier.isStatic(method.getModifiers()))
         {
             throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
-                    + " annotated method : " + annotatedMethod.getJavaMember().getName()
+                    + " annotated method : " + method.getName()
                     + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
                     + " can not be static");
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
Sun Oct  5 09:09:44 2014
@@ -19,7 +19,6 @@
 package org.apache.webbeans.util;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -94,28 +93,7 @@ public final class AnnotationUtil
 
     /**
      * Check given annotation exist on the method.
-     * 
-     * @param method method
-     * @param clazz annotation class
-     * @return true or false
-     */
-    public static boolean hasMethodAnnotation(Method method, Class<? extends Annotation>
clazz)
-    {
-        final AnnotatedElement element = method;
-        Annotation[] anns = getDeclaredAnnotations(element);
-        for (Annotation annotation : anns)
-        {
-            if (annotation.annotationType().equals(clazz))
-            {
-                return true;
-            }
-        }
-
-        return false;
-
-    }
-
-    /**
+     *
      * Utility method to get around some errors caused by
      * interactions between the Equinox class loaders and
      * the OpenJPA transformation process.  There is a window
@@ -128,20 +106,21 @@ public final class AnnotationUtil
      * defined on the second pass, this should succeed.  If
      * we get a second exception, then it's likely some
      * other problem.
-     *
-     * @param element The AnnotatedElement we need information for.
-     *
-     * @return An array of the Annotations defined on the element.
+
+     * @param method method
+     * @param clazz annotation class
+     * @return true or false
      */
-    private static Annotation[] getDeclaredAnnotations(AnnotatedElement element)
+    public static boolean hasMethodAnnotation(Method method, Class<? extends Annotation>
clazz)
     {
         try
         {
-            return element.getDeclaredAnnotations();
+            return method.getAnnotation(clazz) != null;
         }
-        catch (LinkageError e)
+        catch (LinkageError le)
         {
-            return element.getDeclaredAnnotations();
+            // try once again
+            return method.getAnnotation(clazz) != null;
         }
     }
 
@@ -164,33 +143,6 @@ public final class AnnotationUtil
         return false;
     }
 
-    public static <X> boolean hasAnnotatedMethodMultipleParameterAnnotation(AnnotatedMethod<X>
annotatedMethod, Class<? extends Annotation> clazz)
-    {
-        Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
-        Asserts.nullCheckForClass(clazz);
-
-        boolean found = false;
-        
-        List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
-        for(AnnotatedParameter<X> parameter : parameters)
-        {
-            if(parameter.isAnnotationPresent(clazz))
-            {
-                if(!found)
-                {
-                    found = true;
-                }
-                else
-                {
-                    return true;   
-                }                
-            }
-        }
-        
-        
-        return false;
-    }
-    
     public static <X> AnnotatedParameter<X> getFirstAnnotatedParameter(AnnotatedMethod<X>
annotatedMethod, Class<? extends Annotation> annotation)
     {
         for (AnnotatedParameter<X> annotatedParameter: annotatedMethod.getParameters())
@@ -425,8 +377,7 @@ public final class AnnotationUtil
      *
      * @param qualifierAnnotationType
      */
-    private static List<Method> getBindingCdiAnnotationMethods(
-            Class<? extends Annotation> qualifierAnnotationType)
+    private static List<Method> getBindingCdiAnnotationMethods(Class<? extends Annotation>
qualifierAnnotationType)
     {
         Method[] qualifierMethods = qualifierAnnotationType.getDeclaredMethods();
 
@@ -436,32 +387,9 @@ public final class AnnotationUtil
 
             for (Method qualifierMethod : qualifierMethods)
             {
-                Annotation[] qualifierMethodAnnotations = getDeclaredAnnotations(qualifierMethod);
-
-                if (qualifierMethodAnnotations.length > 0)
-                {
-                    // look for @Nonbinding
-                    boolean nonbinding = false;
-
-                    for (Annotation qualifierMethodAnnotation : qualifierMethodAnnotations)
-                    {
-                        if (Nonbinding.class.equals(
-                                qualifierMethodAnnotation.annotationType()))
-                        {
-                            nonbinding = true;
-                            break;
-                        }
-                    }
-
-                    if (!nonbinding)
-                    {
-                        // no @Nonbinding found - add to list
-                        bindingMethods.add(qualifierMethod);
-                    }
-                }
-                else
+                if (!hasMethodAnnotation(qualifierMethod, Nonbinding.class))
                 {
-                    // no method-annotations - add to list
+                    // no @Nonbinding found - add to list
                     bindingMethods.add(qualifierMethod);
                 }
             }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
Sun Oct  5 09:09:44 2014
@@ -28,7 +28,6 @@ import org.apache.webbeans.test.annotati
 import org.apache.webbeans.test.component.service.IService;
 
 @Decorator
-@Named
 public  class ServiceDecorator implements IService
 {
     private @Inject @Delegate @Binding1 IService delegate;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
Sun Oct  5 09:09:44 2014
@@ -21,10 +21,11 @@ package org.apache.webbeans.test.compone
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
+import java.io.Serializable;
 
 @Interceptor
 @Transactional
-public class TransactionalInterceptor
+public class TransactionalInterceptor implements Serializable
 {
 
     @AroundInvoke

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
Sun Oct  5 09:09:44 2014
@@ -28,6 +28,8 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
 
 import org.apache.webbeans.intercept.InterceptorResolutionService;
 import org.apache.webbeans.test.AbstractUnitTest;
@@ -64,6 +66,8 @@ import static org.apache.webbeans.interc
 public class InterceptorResolutionServiceTest extends AbstractUnitTest
 {
 
+    private static final Logger log = Logger.getLogger(InterceptorResolutionServiceTest.class.getName());
+
     @Test
     public void testClassLevelSingleInterceptor() throws Exception
     {
@@ -156,7 +160,16 @@ public class InterceptorResolutionServic
         Bean<ClassMultiInterceptedClass> bean =
                 (Bean<ClassMultiInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(ClassMultiInterceptedClass.class));
 
-        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(),
bean.getQualifiers(), annotatedType);
+        BeanInterceptorInfo interceptorInfo = null;
+        long start = System.nanoTime();
+        for (int i=0; i < 2; i++)
+        {
+            // for being able to do some cheap performance tests
+            interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+        }
+        long end = System.nanoTime();
+        log.info("calculating the interceptor info took " + TimeUnit.NANOSECONDS.toMillis(end-start)
+ " ms");
+
         Assert.assertNotNull(interceptorInfo);
 
         Assert.assertNotNull(interceptorInfo.getCdiInterceptors());

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/performance/StartupPerformanceTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/performance/StartupPerformanceTest.java?rev=1629479&r1=1629478&r2=1629479&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/performance/StartupPerformanceTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/performance/StartupPerformanceTest.java
Sun Oct  5 09:09:44 2014
@@ -20,8 +20,36 @@ package org.apache.webbeans.test.perform
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
 
 import org.apache.webbeans.test.AbstractUnitTest;
+import org.apache.webbeans.test.component.binding.AnyBindingComponent;
+import org.apache.webbeans.test.component.binding.DefaultAnyBinding;
+import org.apache.webbeans.test.component.binding.NonAnyBindingComponent;
+import org.apache.webbeans.test.component.decorator.clean.AccountComponent;
+import org.apache.webbeans.test.component.decorator.clean.LargeTransactionDecorator;
+import org.apache.webbeans.test.component.decorator.clean.ServiceDecorator;
+import org.apache.webbeans.test.component.definition.BeanTypesDefinedBean;
+import org.apache.webbeans.test.component.dependent.DependentComponent;
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+import org.apache.webbeans.test.component.dependent.MultipleDependentComponent;
+import org.apache.webbeans.test.component.dependent.circular.DependentA;
+import org.apache.webbeans.test.component.dependent.circular.DependentB;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObservable1;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves1;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves2;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves3;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves4;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves5;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves6;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves7;
+import org.apache.webbeans.test.component.event.normal.Transactional;
+import org.apache.webbeans.test.component.event.normal.TransactionalInterceptor;
+import org.apache.webbeans.test.component.inheritance.InheritFromMultipleParentComponent;
+import org.apache.webbeans.test.component.inheritance.InheritFromParentComponent;
+import org.apache.webbeans.test.component.inheritance.ParentComponent;
+import org.apache.webbeans.test.component.inheritance.ParentComponentSubClass;
 import org.apache.webbeans.test.concepts.alternatives.common.AlternativeBean;
 import org.apache.webbeans.test.concepts.alternatives.common.Pencil;
 import org.apache.webbeans.test.concepts.alternatives.common.PencilProducerBean;
@@ -62,20 +90,12 @@ public class StartupPerformanceTest exte
 {
     private static final int NUMBER_ITERATIONS = 2;
 
+    private static final Logger log = Logger.getLogger(StartupPerformanceTest.class.getName());
+
 
     @Test
     public void testPerformance()
     {
-        for (int i=0; i < NUMBER_ITERATIONS; i++)
-        {
-            startupWithClasses();
-        }
-    }
-
-    private void startupWithClasses()
-    {
-        Collection<String> beanXmls = new ArrayList<String>();
-
         Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
         beanClasses.add(PaymentProcessorComponent.class);
         beanClasses.add(InstanceInjectedComponent.class);
@@ -102,18 +122,57 @@ public class StartupPerformanceTest exte
         beanClasses.add(DependentBean.class);
         beanClasses.add(DependentBeanProducer.class);
         beanClasses.add(InstanceForDependentBean.class);
-
-
         beanClasses.add(MyProductBean.class);
         beanClasses.add(MyProductProducer.class);
         beanClasses.add(ProductInjectedBean.class);
-
         beanClasses.add(StringProducerBean.class);
         beanClasses.add(GetterStringFieldInjector.class);
         beanClasses.add(GetterStringProducerBean.class);
         beanClasses.add(InformationConsumerBean.class);
         beanClasses.add(MultipleListProducer.class);
         beanClasses.add(GetterStringProducerBean.class);
+        beanClasses.add(AnyBindingComponent.class);
+        beanClasses.add(DefaultAnyBinding.class);
+        beanClasses.add(NonAnyBindingComponent.class);
+        beanClasses.add(AccountComponent.class);
+        beanClasses.add(BeanTypesDefinedBean.class);
+        beanClasses.add(DependentA.class);
+        beanClasses.add(DependentB.class);
+        beanClasses.add(DependentComponent.class);
+        beanClasses.add(DependentOwnerComponent.class);
+        beanClasses.add(MultipleDependentComponent.class);
+        beanClasses.add(ComponentWithObservable1.class);
+        beanClasses.add(ComponentWithObserves1.class);
+        beanClasses.add(ComponentWithObserves2.class);
+        beanClasses.add(ComponentWithObserves3.class);
+        beanClasses.add(ComponentWithObserves4.class);
+        beanClasses.add(ComponentWithObserves5.class);
+        beanClasses.add(ComponentWithObserves6.class);
+        beanClasses.add(ComponentWithObserves7.class);
+        beanClasses.add(InheritFromMultipleParentComponent.class);
+        beanClasses.add(InheritFromParentComponent.class);
+        beanClasses.add(ParentComponent.class);
+        beanClasses.add(ParentComponentSubClass.class);
+
+        beanClasses.add(Transactional.class);
+        addInterceptor(TransactionalInterceptor.class);
+
+        addDecorator(LargeTransactionDecorator.class);
+        addDecorator(ServiceDecorator.class);
+
+        long start = System.nanoTime();
+        for (int i=0; i < NUMBER_ITERATIONS; i++)
+        {
+            startupWithClasses(beanClasses);
+        }
+        long stop = System.nanoTime();
+        log.info("Starting up " + beanClasses.size() + " classes " + NUMBER_ITERATIONS +
" times took " + TimeUnit.NANOSECONDS.toMillis(stop - start) + " ms");
+    }
+
+    private void startupWithClasses(Collection<Class<?>> beanClasses)
+    {
+        Collection<String> beanXmls = new ArrayList<String>();
+
 
         startContainer(beanClasses, beanXmls);
 



Mime
View raw message