abhishekagarwal87 commented on a change in pull request #10761:
URL: https://github.com/apache/druid/pull/10761#discussion_r558817270



##########
File path: services/src/main/java/org/apache/druid/cli/PullDependencies.java
##########
@@ -83,6 +83,9 @@
                   .put("commons-beanutils", "commons-beanutils")
                   .put("org.apache.commons", "commons-compress")
                   .put("org.apache.zookeeper", "zookeeper")
+                  .put("com.fasterxml.jackson.core", "jackson-databind")
+                  .put("com.fasterxml.jackson.core", "jackson-core")
+                  .put("com.fasterxml.jackson.core", "jackson-annotations")

Review comment:
       I will try to add as much context as possible - 
   Usually, custom classloaders in Java have parent first behavior. That is, 
say there is a classloader X of which Y is a parent. Now when X is trying to 
load a class, it will first ask Y to load it if the class is not loaded. When 
`useExtensionClassloaderFirst` is set to false, we inverse the relationship. If 
a class is not loaded, X will load this class by itself first. X will delegate 
loading to Y if it can't find the class. 
   
   Now, this child first behavior can cause a situation where X loads a class 
SimpleModule and its superclass Module on its own, and the same classes are 
also loaded by Y too. When you cast a class `SimpleModule` loaded by X to a 
class `Module` loaded by Y, you will get an exception since classloaders are 
different for these classes. This is exactly what happens when the broker is 
loading the extension modules. 
   
   So ideally we want to avoid a situation where you have the same classes 
loaded by both classloaders. `PROVIDED_CORE` is a way within PullDependencies 
to exclude certain dependencies being shipped with the extension since they are 
already being provided by the core. That way, class can only be loaded by the 
parent classloader. 




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to