2 Replies Latest reply on Apr 26, 2006 8:59 AM by villi

    Alpha 6 - EJB3StandaloneBootstrap.scanClassPath - very slow

    villi

      Hi, I am having problems with embedded EJB3:

      In my case, I am running from within eclipse, the launch configuration has
      a *lot* of class directories and jars.

      EJBStandaloneBootstrap.boot(null) takes 2 seconds.

      EJBStandaloneBootstrap.scanClassPath() takes 8 minutes on 100%cpu
      (1.9Ghz Pentium M).

      When I sample the stack, most of the time seems to be spent looking for
      "int.class" (sometimes int[].class) in every class directory - over and over again.

      There is definitely some room for improvement there.

      A typical stack trace follows:
      WinNTFileSystem.getBooleanAttributes(File) line: not available [native method]
      File.exists() line: not available [local variables unavailable]
      URLClassPath$FileLoader.getResource(String, boolean) line: not available
      URLClassPath$FileLoader.findResource(String, boolean) line: not available
      URLClassPath.findResource(String, boolean) line: not available
      URLClassLoader$2.run() line: not available
      AccessController.doPrivileged(PrivilegedAction, AccessControlContext) line: not available [native method]
      Launcher$AppClassLoader(URLClassLoader).findResource(String) line: not available
      Launcher$AppClassLoader(ClassLoader).getResource(String) line: not available
      LoaderClassPath.find(String) line: 86
      ClassPoolTail.find(String) line: 317
      AOPClassPool(ClassPool).find(String) line: 467
      AOPClassPool(ClassPool).createCtClass(String, boolean) line: 445
      AOPClassPool(ClassPool).get0(String, boolean) line: 417
      AOPClassPool(ClassPool).get(String) line: 386
      Descriptor.toCtClass(ClassPool, String, int, CtClass[], int) line: 549
      Descriptor.getParameterTypes(String, ClassPool) line: 396
      CtMethod(CtBehavior).getParameterTypes() line: 176
      ReflectToJavassist.methodToJavassist(Method) line: 129
      PortableAnnotationElement.isAnyAnnotationPresent(Method, String) line: 119
      StatelessContainer(Advisor).hasAnnotation(Method, String) line: 402
      MethodMatcher.matchesIdentifier(ASTMethod) line: 235
      MethodMatcher.matches(ASTMethod) line: 95
      Util.has(Class, ASTMethod, Advisor, boolean) line: 392
      Util.has(Class, ASTMethod, Advisor) line: 381
      TypeMatcher.visit(ASTHas, Object) line: 129
      ASTHas.jjtAccept(TypeExpressionParserVisitor, Object) line: 42
      TypeMatcher.visit(ASTOr, Object) line: 114
      ASTOr.jjtAccept(TypeExpressionParserVisitor, Object) line: 42
      TypeMatcher.visit(ASTSub, Object) line: 98
      ASTSub.jjtAccept(TypeExpressionParserVisitor, Object) line: 42
      TypeMatcher.visit(ASTBoolean, Object) line: 78
      ASTBoolean.jjtAccept(TypeExpressionParserVisitor, Object) line: 42
      TypeMatcher.visit(ASTStart, Object) line: 73
      ASTStart.jjtAccept(TypeExpressionParserVisitor, Object) line: 42
      TypedefExpression.matches(Advisor, Class) line: 68
      Util.matchesTypedef(Class, ClassExpression, Advisor) line: 451
      Util.matchesClassExpr(ClassExpression, Class, Advisor) line: 126
      ExecutionMethodMatcher(MethodMatcher).matchesClass(ASTMethod) line: 192
      ExecutionMethodMatcher(MethodMatcher).matches(ASTMethod) line: 94
      ExecutionMethodMatcher(MethodMatcher).visit(ASTMethod, Object) line: 88
      ASTMethod.jjtAccept(PointcutExpressionParserVisitor, Object) line: 43
      ExecutionMethodMatcher.visit(ASTExecution, Object) line: 58
      ASTExecution.jjtAccept(PointcutExpressionParserVisitor, Object) line: 37
      ExecutionMethodMatcher(MatcherHelper).visit(ASTStart, Object) line: 88
      ExecutionMethodMatcher(MatcherHelper).matches() line: 83
      PointcutExpression.matchesExecution(Advisor, Method, boolean) line: 124
      StatelessContainer(Advisor).resolveMethodPointcut(TLongObjectHashMap, AdviceBinding) line: 649
      StatelessContainer(ClassContainer).createInterceptorChains() line: 247
      StatelessContainer(ClassContainer).rebuildInterceptors() line: 113
      StatelessContainer(ClassContainer).addClassMetaData(ClassMetaDataBinding) line: 125
      JaccHelper.addJaccContextToContainer(String, EJBContainer) line: 261
      JaccHelper.configureContainer(String, EJBContainer) line: 124
      StatelessContainer(EJBContainer).start() line: 557
      StatelessContainer(SessionContainer).start() line: 82
      StatelessContainer.start() line: 80
      NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
      NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
      DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
      Method.invoke(Object, Object...) line: not available
      ReflectionUtils.invoke(Method, Object, Object[]) line: 55
      ReflectMethodInfoImpl.invoke(Object, Object[]) line: 107
      BasicMethodJoinPoint.dispatch() line: 66
      KernelControllerContextActions$DispatchJoinPoint.run() line: 815
      AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) line: not available [native method]
      KernelControllerContextActions.dispatchJoinPoint(KernelControllerContext, Joinpoint) line: 107
      KernelControllerContextActions$StartStopLifecycleAction(KernelControllerContextActions$LifecycleAction).installAction(KernelControllerContext) line: 583
      KernelControllerContextActions$KernelControllerContextAction$1.run() line: 184
      AccessController.doPrivileged(PrivilegedExceptionAction) line: not available [native method]
      KernelControllerContextActions$StartStopLifecycleAction(KernelControllerContextActions$KernelControllerContextAction).install(ControllerContext) line: 207
      KernelControllerContextActions(AbstractControllerContextActions).install(ControllerContext, ControllerState, ControllerState) line: 51
      AbstractKernelControllerContext(AbstractControllerContext).install(ControllerState, ControllerState) line: 226
      AbstractKernelController(AbstractController).install(ControllerContext, ControllerState, ControllerState) line: 593
      AbstractKernelController(AbstractController).incrementState(ControllerContext, boolean) line: 346
      AbstractKernelController(AbstractController).resolveContexts(ControllerState, ControllerState, boolean) line: 438
      AbstractKernelController(AbstractController).resolveContexts(boolean) line: 379
      AbstractKernelController(AbstractController).install(ControllerContext, boolean) line: 225
      AbstractKernelController(AbstractController).install(ControllerContext) line: 151
      AbstractKernelController.install(BeanMetaData, Object) line: 79
      AbstractKernelController.install(BeanMetaData) line: 73
      MCKernelAbstraction.install(String, DependencyPolicy, Object) line: 86
      EJB3StandaloneDeployment(Ejb3Deployment).registerEJBContainer(Container) line: 437
      EJB3StandaloneDeployment(Ejb3Deployment).start() line: 484
      EJB3StandaloneDeployer.start() line: 450
      EJB3StandaloneBootstrap.scanClasspath() line: 241


        • 1. Re: Alpha 6 - EJB3StandaloneBootstrap.scanClassPath - very s
          bdecoste

          Can you quantify what you mean by "a lot of class directories and jars" so I can set up a testcase?

          • 2. Re: Alpha 6 - EJB3StandaloneBootstrap.scanClassPath - very s
            villi

            Hi, I ran some tests to try to give you something concrete.

            You should be able to reproduce this by doing the following:

            Create @Remote interface with 50 methods like:

             public int testMethod00(int[] arg1,int arg2);
            


            Create @Stateless bean implementing interface with dummy methods.

            Run
             EJB3StandaloneBootstrap.boot(null);
             EJB3StandaloneBootstrap.scanClasspath();
            


            By having 10 empty directories in the classpath, this takes around 1 minute.

            NB: Although the number of class directories affect the time , increasing the number
            of methods seems to have an exponential effect.

            Given an email address, I could send my test
            case.