johnyannj opened a new issue #1221: 关于servicecomb对SPI扩展的使用问题
URL: https://github.com/apache/servicecomb-java-chassis/issues/1221
 
 
   servicecomb有好多处使用了SPI扩展。
   
   使用SPI的方式全部都是
   ServiceLoader.load(className);
   
   它默认使用线程上下文里的classloader去寻找SPI文件和加载类。
   
   ServiceLoader有另外一个方法是
   public static <S> ServiceLoader<S> load(Class<S> service,
                                               ClassLoader loader)
   可以指定classloader
   
   我觉得servicecomb应该使用第二个方法可能习惯更好一点。 把加载servicecomb类的classloader传给他。
   
   这样可以允许业务考虑使用独立的classloader加载servicecomb。
   
   
   

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