Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-820

During the compilation of a KieModule with dependencies the pom is parsed multiple times

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 6.3.0.CR1
    • Component/s: None
    • Labels:
      None

      Description

      When a KieModule has dependencies we have a big inefficiency because its pom is parsed multiple times. In particular the parsing happens:

      1. When the KieBuilder creates the pom model:

        java.lang.Thread.State: RUNNABLE
      	  at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:39)
      	  at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:35)
      	  at org.kie.scanner.MavenPomModelGenerator.parse(MavenPomModelGenerator.java:19)
      	  at org.drools.compiler.kproject.xml.PomModel$Parser.parse(PomModel.java:64)
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildPomModel(KieBuilderImpl.java:407)
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.init(KieBuilderImpl.java:116)
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:149)
      	  at org.kie.scanner.AbstractKieCiTest.createKieJarWithDependencies(AbstractKieCiTest.java:47)
      	  at org.kie.scanner.KieRepositoryScannerTest.testKScannerWithDependencies(KieRepositoryScannerTest.java:104)
      

      2. In a for-loop once for each of the direct dependencies (this is particularly bad)

        java.lang.Thread.State: RUNNABLE
      	  at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:39)
      	  at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:35)
      	  at org.kie.scanner.ArtifactResolver.getResolverFor(ArtifactResolver.java:112)
      	  at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:95)
      	  - locked <0x10b6> (a org.kie.scanner.KieRepositoryScannerImpl)
      	  at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:113)
      	  at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:99)
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.init(KieBuilderImpl.java:130) <-- IN A FOR-LOOP !!!
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:149)
      	  at org.kie.scanner.AbstractKieCiTest.createKieJarWithDependencies(AbstractKieCiTest.java:47)
      	  at org.kie.scanner.KieRepositoryScannerTest.testKScannerWithDependencies(KieRepositoryScannerTest.java:104)
      

      3. When creating the ClassLoader for the KieProject

        java.lang.Thread.State: RUNNABLE
      	  at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:21)
      	  at org.kie.scanner.embedder.MavenProjectLoader.loadMavenProject(MavenProjectLoader.java:67)
      	  - locked <0x647> (a java.lang.Class)
      	  at org.kie.scanner.Aether.<init>(Aether.java:46)
      	  at org.kie.scanner.Aether.getAether(Aether.java:56)
      	  - locked <0x15d8> (a java.lang.Class)
      	  at org.kie.scanner.MavenRepository.getMavenRepository(MavenRepository.java:73)
      	  - locked <0x15d7> (a java.lang.Class)
      	  at org.kie.scanner.ArtifactResolver.getPomFileForGAV(ArtifactResolver.java:118)
      	  at org.kie.scanner.ArtifactResolver.getResolverFor(ArtifactResolver.java:84)
      	  at org.kie.scanner.MavenClassLoaderResolver.getClassLoader(MavenClassLoaderResolver.java:55)
      	  at org.drools.compiler.kie.builder.impl.KieModuleKieProject.<init>(KieModuleKieProject.java:53)
      	  at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:171)
      	  at org.kie.scanner.AbstractKieCiTest.createKieJarWithDependencies(AbstractKieCiTest.java:47)
      

      The main reason of this inefficiency is caused by the fact that the product of this pom parsing process are maven/aether classes that cannot be referenced in drools-compiler and then are recreated every time the compiler invokes kie-ci.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mfusco Mario Fusco
                Reporter:
                mfusco Mario Fusco
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: