[jboss-user] [JBoss Microcontainer Development POJO Server] - Implementing a non-flat deployment for Weld Integration

Flavia Rainone do-not-reply at jboss.com
Fri Jul 23 07:56:58 EDT 2010

Flavia Rainone [http://community.jboss.org/people/flavia.rainone%40jboss.com] replied to the discussion

"Implementing a non-flat deployment for Weld Integration"

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

This is about the TODO comment that Ales added to DeploymentImpl:

public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
      // collection to mark the archives we have already searched
      Collection<Archive> searchedArchives = new HashSet<Archive>();
      // collection to mark the classpaths we have already searched
      Collection<Classpath> searchedClasspaths = new HashSet<Classpath>();
      // TODO -- why the search? beanClass' ClassLoader should be mapped to Archive?
      // need to throw an IllegalArgumentException if the Archive is not reachable from
      // the archives contained in the archives of this deployment
      Archive archive = findArchive(beanClass, archives, searchedArchives, searchedClasspaths);
      if (archive == null)

I put a temporary answer right below the TODO as you can see. It is undeniable that Ales' suggested approach is much simpler and faster than searching for the Archive in the graph.

The problem is that we need to throw the IllegalArgumentException whenever the Archive is not reachable. I'm wondering if that exception is really necessary, as IMHO the gains of following Ales suggestion outweight the fact that we are not checking for Archive visibility.

So, in order for this exception to happen, we would need to assume that Weld is asking for a bean loaded by a ClassLoader that is not visible to the ClassLoader that loaded the current deployment. Would this scenario ever happen?


Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development POJO Server at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100723/9b9dcbf5/attachment.html 

More information about the jboss-user mailing list