[jboss-dev-forums] [JBoss AS7 Development] - Re: Lazy modules resolving / linking

Ales Justin do-not-reply at jboss.com
Sun Sep 26 08:06:48 EDT 2010


Ales Justin [http://community.jboss.org/people/alesj] created the discussion

"Re: Lazy modules resolving / linking"

To view the discussion, visit: http://community.jboss.org/message/563680#563680

--------------------------------------------------------------
> You could use the same idea for lazy loading.  In your fallback loader, attempt to load the corresponding module.  If it succeeds, add it as a dependency to the Module, and then relink the module; then retry the load.
OK, this would work.

protected LocalLoader doUpdate(String[] tokens)
   {
      Node<Import> current = root;
      StringBuilder path = new StringBuilder();
      for (String token : tokens)
      {
         current = current.getChild(token);
         if (current == null)
            return null;

         if (path.length() > 0)
            path.append(".");
         path.append(token);

         Import i = current.getValue();
         if (i != null)
         {
            ModuleIdentifier mi = ModuleIdentifier.create(path.toString(), i.getVersion().toString());
            ModuleDependencySpec.Builder mdsb = ModuleDependencySpec.build(mi).setOptional(i.isOptional());
            if (i.isExport()) // TODO -- relink depending modules ...
               mdsb.setExportFilter(PathFilters.acceptAll());
            ModuleDependencySpec mds = mdsb.create();
            DependencySpec dependencySpec = dependencyBuilder.addModuleDependency(mds).create();
            try
            {
               Module module = Module.getModule(target);
               loader.updateModule(module, dependencySpec);
               return module.getModuleLocalLoader(); // <--------- HERE
            }
            catch (ModuleLoadException ignored)
            {
               return null;
            }
         }
      }
      return null;
   }

but in order not to hack around too much, I would need somthing like "HERE".
Exposing too much if we expose ModuleClassLoader's LocalLoader?

btw: any tip on how to relink dependeing modules from TODO?
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/563680#563680]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100926/dd96a0f5/attachment.html 


More information about the jboss-dev-forums mailing list