tomsun28 commented on code in PR #2523:
URL: https://github.com/apache/hertzbeat/pull/2523#discussion_r1720931101


##########
collector/src/main/java/org/apache/hertzbeat/collector/collect/jmx/JmxCollectImpl.java:
##########
@@ -73,6 +74,7 @@ public class JmxCollectImpl extends AbstractCollect {
 
     public JmxCollectImpl() {
         connectionCommonCache = new ConnectionCommonCache<>();
+        Thread.currentThread().setContextClassLoader(new 
ClassLoaderConfig(ClassLoader.getSystemClassLoader()));
     }

Review Comment:
   Hi, this seem can not work due the constructor new JmxCollectImpl() is call 
by the thread-A and  JmxCollectImpl is singleton, but the 
`JmxCollectImpl.collect` is run by another thread-B in running-thread-pool.  
`Thread.currentThread().setContextClassLoader` only can take effect on the 
current thread. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to