Generated classes by exec-model will be defined by ProjectClassLoader.
e.g.
defaultpkg.RulesE4CC7C50982E2CF1DC179E1E3E3D6F82 defaultpkg.RulesE4CC7C50982E2CF1DC179E1E3E3D6F82RuleMethods0 defaultpkg.DomainClassesMetadataE4CC7C50982E2CF1DC179E1E3E3D6F82 defaultpkg.DomainClassesMetadataE4CC7C50982E2CF1DC179E1E3E3D6F82$org_drools_modelcompiler_domain_Person_Metadata defaultpkg.P77.LambdaPredicate7795465E4BC69C081E65B427482C98AE ...
But they are firstly searched with Class.forName() by its parent classloader which is a waste of time.
DynamicProjectClassLoader.java
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { try { return loadType(name, resolve); } catch (ClassNotFoundException cnfe) { try { return projectClassLoader.internalLoadClass(name, resolve); } catch (ClassNotFoundException cnfe2) { return projectClassLoader.tryDefineType(name, cnfe); } } }
ProjectClassLoader.java
public Class<?> internalLoadClass(String name, boolean resolve) throws ClassNotFoundException { if (CACHE_NON_EXISTING_CLASSES && nonExistingClasses.contains(name)) { throw dummyCFNE; } if (droolsClassLoader != null) { try { return Class.forName(name, resolve, droolsClassLoader); } catch (ClassNotFoundException e) { } } try { return super.loadClass(name, resolve); } catch (ClassNotFoundException e) { return Class.forName(name, resolve, getParent()); } }
- clones
-
DROOLS-6053 Reduce unnecessary classloading by parent classloader
- Closed