in src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java [1367:1386]
public final void setEvictionPolicyClassName(final String evictionPolicyClassName, final ClassLoader classLoader) {
// Getting epClass here and now best matches the caller's environment
final Class<?> epClass = EvictionPolicy.class;
final ClassLoader epClassLoader = epClass.getClassLoader();
try {
try {
setEvictionPolicy(evictionPolicyClassName, classLoader);
} catch (final ClassCastException | ClassNotFoundException e) {
setEvictionPolicy(evictionPolicyClassName, epClassLoader);
}
} catch (final ClassCastException e) {
throw new IllegalArgumentException("Class " + evictionPolicyClassName + " from class loaders [" +
classLoader + ", " + epClassLoader + "] do not implement " + EVICTION_POLICY_TYPE_NAME);
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException |
InvocationTargetException | NoSuchMethodException e) {
throw new IllegalArgumentException(
"Unable to create " + EVICTION_POLICY_TYPE_NAME + " instance of type " + evictionPolicyClassName,
e);
}
}