JBoss Community

Re: Lazy modules resolving / linking

created by Ales Justin in JBoss AS7 Development - View the full discussion

Adding and usgin something like this helps:

 

public final class ModuleLocalLoader extends ClassLoaderLocalLoader {

 

    private final Module module;

 

    public ModuleLocalLoader(Module module) {
        super(check(module));
        this.module = module;
    }

 

    private static ClassLoader check(Module module) {
        if (module == null)
            throw new IllegalArgumentException("Null module");
        return module.getClassLoader();
    }

 

    public Class<?> loadClassLocal(final String name, final boolean resolve) {
        return module.loadModuleClass(name, false, resolve);
    }
}

 

It's public, but it exposes only read only stuff.

Wdyt?

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community