wu-sheng commented on a change in pull request #4325: Close leaked I/O stream 
and remove unused codes
URL: https://github.com/apache/skywalking/pull/4325#discussion_r376367341
 
 

 ##########
 File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
 ##########
 @@ -62,34 +61,22 @@
     private ReentrantLock jarScanLock = new ReentrantLock();
 
     /**
-     * Functional Description: solve the classloader dead lock when jvm start
-     * only support JDK7+, since ParallelCapable appears in JDK7+
+     * Try to solve the classloader dead lock.
+     *
+     * @see <a href="https://github.com/apache/skywalking/pull/2016";>#2016</a>
      */
     private static void tryRegisterAsParallelCapable() {
-        Method[] methods = ClassLoader.class.getDeclaredMethods();
-        for (int i = 0; i < methods.length; i++) {
-            Method method = methods[i];
-            String methodName = method.getName();
-            if ("registerAsParallelCapable".equalsIgnoreCase(methodName)) {
-                try {
-                    method.setAccessible(true);
-                    method.invoke(null);
-                } catch (Exception e) {
-                    logger.warn(e, "can not invoke 
ClassLoader.registerAsParallelCapable()");
-                }
-                return;
-            }
-        }
+        registerAsParallelCapable();
 
 Review comment:
   You should delete this method, and move `registerAsParallelCapable` to the 
static initial block.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to