This is an automated email from the ASF dual-hosted git repository.

ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new c68a398  IGNITE-13439 Printing detailed classpath slowdowns node 
initialization - Fixes #8246.
c68a398 is described below

commit c68a398cd3de16488634f1d3426bfeca054e6699
Author: Pavel Vinokurov <vinokurov.pa...@gmail.com>
AuthorDate: Mon Sep 21 19:10:34 2020 +0300

    IGNITE-13439 Printing detailed classpath slowdowns node initialization - 
Fixes #8246.
    
    Signed-off-by: Ilya Kasnacheev <ilya.kasnach...@gmail.com>
---
 .../org/apache/ignite/internal/IgniteKernal.java    | 21 +--------------------
 .../apache/ignite/ClassPathContentLoggingTest.java  | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 7d79035..aaeb8cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -839,25 +839,6 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     }
 
     /**
-     * @param clsPathEntry Classpath file to process.
-     * @param clsPathContent StringBuilder to attach path to.
-     */
-    private void ackClassPathElementRecursive(File clsPathEntry, SB 
clsPathContent) {
-        if (clsPathEntry.isDirectory()) {
-            String[] list = clsPathEntry.list();
-
-            for (String listElement : list)
-                ackClassPathElementRecursive(new File(clsPathEntry, 
listElement), clsPathContent);
-        }
-        else {
-            String path = clsPathEntry.getAbsolutePath();
-
-            if (path.endsWith(".class"))
-                clsPathContent.a(path).a(";");
-        }
-    }
-
-    /**
      * @param clsPathEntry Classpath string to process.
      * @param clsPathContent StringBuilder to attach path to.
      */
@@ -865,7 +846,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
         File clsPathElementFile = new File(clsPathEntry);
 
         if (clsPathElementFile.isDirectory())
-            ackClassPathElementRecursive(clsPathElementFile, clsPathContent);
+            clsPathContent.a(clsPathEntry).a(";");
         else {
             String extension = clsPathEntry.length() >= 4
                 ? clsPathEntry.substring(clsPathEntry.length() - 
4).toLowerCase()
diff --git 
a/modules/core/src/test/java/org/apache/ignite/ClassPathContentLoggingTest.java 
b/modules/core/src/test/java/org/apache/ignite/ClassPathContentLoggingTest.java
index 6777d92..3c17811 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/ClassPathContentLoggingTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/ClassPathContentLoggingTest.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Arrays;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.testframework.ListeningTestLogger;
 import org.apache.ignite.testframework.LogListener;
@@ -82,6 +83,8 @@ public class ClassPathContentLoggingTest extends 
GridCommonAbstractTest {
      */
     @Test
     public void testClassPathContentLogging() throws Exception {
+        String javaClassPath = System.getProperty("java.class.path", ".");
+
         LogListener lsnr = LogListener
             .matches("List of files containing in classpath")
             .build();
@@ -94,7 +97,7 @@ public class ClassPathContentLoggingTest extends 
GridCommonAbstractTest {
             .matches("Could not log class path entry")
             .build();
 
-        LogListener.Builder jarLsnrBuilder = LogListener.builder();
+        LogListener.Builder contenLsnrBuilder = LogListener.builder();
 
         String jarPath = new StringBuilder(javaHome)
             .append(javaHome.endsWith(File.separator) ? "" : File.separator)
@@ -105,20 +108,24 @@ public class ClassPathContentLoggingTest extends 
GridCommonAbstractTest {
         Iterable<Path> jars = Files.newDirectoryStream(Paths.get(jarPath), 
"*.jar");
 
         for (Path jar : jars)
-            jarLsnrBuilder.andMatches(jar.getFileName().toString());
+            contenLsnrBuilder.andMatches(jar.getFileName().toString());
+
+        Arrays.stream(javaClassPath.split(File.separator))
+            .filter(fileName -> new File(fileName).isDirectory())
+            .forEach(contenLsnrBuilder::andMatches);
 
-        LogListener jarLsnr = jarLsnrBuilder.build();
+        LogListener contentLsnr = contenLsnrBuilder.build();
 
         listeningLog.registerListener(lsnr);
         listeningLog.registerListener(clsPathValuelsnr);
         listeningLog.registerListener(errLsnr);
-        listeningLog.registerListener(jarLsnr);
+        listeningLog.registerListener(contentLsnr);
 
         startGrid(0);
 
         assertTrue(lsnr.check());
         assertTrue(clsPathValuelsnr.check());
-        assertTrue(jarLsnr.check());
+        assertTrue(contentLsnr.check());
 
         assertFalse(errLsnr.check());
     }

Reply via email to