if (classLoading == null)
throw new IllegalStateException("The classLoading has not been set");
if (system == null)
throw new IllegalStateException("The system has not been set");
Module module = unit.getAttachment(Module.class);
if (module == null)
{
if (isTopLevelOnly())
throw new IllegalStateException("No module for top level deployment " + unit.getName());
else
return unit.getParent().getClassLoader();
}
if (module instanceof ClassLoaderPolicyModule == false)
throw new IllegalStateException("Module is not an instance of " + ClassLoaderPolicyModule.class.getName() + " actual=" + module.getClass().getName());
ClassLoaderPolicyModule classLoaderPolicyModule = (ClassLoaderPolicyModule) module;
if (unit.isTopLevel())
{
// Top level, just create the classloader