LiangliangSui commented on code in PR #1792:
URL: https://github.com/apache/fury/pull/1792#discussion_r1703997143


##########
java/fury-core/src/main/java/org/apache/fury/ThreadLocalFury.java:
##########
@@ -257,6 +257,9 @@ public void setClassLoader(ClassLoader classLoader) {
 
   @Override
   public void setClassLoader(ClassLoader classLoader, StagingType stagingType) 
{
+    if (classLoader == null) {

Review Comment:
   This should be redundant, there is already such a way in 
`org.apache.fury.util.LoaderBinding#setClassLoader`



##########
java/fury-core/src/main/java/org/apache/fury/pool/FuryPooledObjectFactory.java:
##########
@@ -50,7 +52,13 @@ public class FuryPooledObjectFactory {
 
   /** ThreadLocal: ClassLoader. */
   private final ThreadLocal<ClassLoader> classLoaderLocal =
-      ThreadLocal.withInitial(() -> 
Thread.currentThread().getContextClassLoader());
+      ThreadLocal.withInitial(() -> {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        if (loader == null) {
+          loader = Fury.class.getClassLoader();
+        }

Review Comment:
   Could we move this into `org.apache.fury.config.FuryBuilder#finish` ?



##########
java/fury-core/src/main/java/org/apache/fury/pool/ThreadPoolFury.java:
##########
@@ -279,6 +279,9 @@ public void setClassLoader(ClassLoader classLoader) {
 
   @Override
   public void setClassLoader(ClassLoader classLoader, 
LoaderBinding.StagingType stagingType) {
+    if (classLoader == null) {

Review Comment:
   `org.apache.fury.pool.FuryPooledObjectFactory#setClassLoader`



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