Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/main/java/io/lettuce/core/internal/LettuceClassUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,13 @@ private static Class<?> forName(String className, ClassLoader classLoader) throw
}

/**
* Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that
* loaded the ClassUtils class will be used as fallback.
* This method ensures that the same ClassLoader strategy is consistently applied during
* both class existence detection and actual class loading.
*
* @return the default ClassLoader (never <code>null</code>)
* @see java.lang.Thread#getContextClassLoader()
*/
private static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back to system class loader...
}
if (cl == null) {
// No thread context class loader -> use class loader of this class.
cl = LettuceClassUtils.class.getClassLoader();
}
return cl;
return LettuceClassUtils.class.getClassLoader();
}

/**
Expand Down