private static Set<ClassLoader> allDeploymentModuleClassLoaders(DeploymentUnit deploymentUnit) {
        Set<ClassLoader> deploymentClassLoaders = new HashSet<ClassLoader>();
        final DeploymentUnit topDeploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
        final Module toplevelModule = topDeploymentUnit.getAttachment(Attachments.MODULE);
        if (toplevelModule != null) {
            deploymentClassLoaders.add(toplevelModule.getClassLoader());
            final List<DeploymentUnit> subDeployments = topDeploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
            for (DeploymentUnit subDeploymentUnit: subDeployments) {
                final Module subDeploymentModule = subDeploymentUnit.getAttachment(Attachments.MODULE);
                if (subDeploymentModule != null) {
                    deploymentClassLoaders.add(subDeploymentModule.getClassLoader());
                }
            }
        }
        return deploymentClassLoaders;
    }
private static Set<ClassLoader> allDeploymentModuleClassLoaders(DeploymentUnit deploymentUnit) {
        Set<ClassLoader> deploymentClassLoaders = new HashSet<ClassLoader>();
        final DeploymentUnit topDeploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
        final Module toplevelModule = topDeploymentUnit.getAttachment(Attachments.MODULE);
        if (toplevelModule != null) {
            deploymentClassLoaders.add(toplevelModule.getClassLoader());
            final List<DeploymentUnit> subDeployments = topDeploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
            for (DeploymentUnit subDeploymentUnit: subDeployments) {
                final Module subDeploymentModule = subDeploymentUnit.getAttachment(Attachments.MODULE);
                if (subDeploymentModule != null) {
                    deploymentClassLoaders.add(subDeploymentModule.getClassLoader());
                }
            }
        }
        return deploymentClassLoaders;
    }
private static Set < ClassLoader > allDeploymentModuleClassLoaders ( DeploymentUnit deploymentUnit ) { Set < ClassLoader > deploymentClassLoaders = new HashSet < ClassLoader > ( ) ; final DeploymentUnit topDeploymentUnit = DeploymentUtils . getTopDeploymentUnit ( deploymentUnit ) ; final Module toplevelModule = topDeploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( toplevelModule != null ) { deploymentClassLoaders . add ( toplevelModule . getClassLoader ( ) ) ; final List < DeploymentUnit > subDeployments = topDeploymentUnit . getAttachmentList ( Attachments . SUB_DEPLOYMENTS ) ; for ( DeploymentUnit subDeploymentUnit : subDeployments ) { final Module subDeploymentModule = subDeploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( subDeploymentModule != null ) { deploymentClassLoaders . add ( subDeploymentModule . getClassLoader ( ) ) ; } } } return deploymentClassLoaders ; }
returns the toplevel deployment module classloader and all subdeployment classloaders

@param deploymentUnit
@return
returns the toplevel deployment module classloader and all subdeployment classloaders