[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 09:58:21 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/554183#554183

Making myself clearer.

> Flavia Rainone wrote:
> *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*)

Currently, findArchive method, invoked by loadBeanDeploymentArchive as shown above, walks through the Archive graph in order to find an Archive associated with the requested beanClass (i.e., an Archive that is associated with the same ClassLoader that loaded beanClass).

If the Archive is not reachable in the graph, it means that we need to throw IllegalArgumentException.

Ales suggested to replace the findArchive call by a lookup in a ClassLoader -> Archive map. That way, all I would need to do is looking up for the archive that corresponds to the beanClass CL. This is faster than walking through the Archive graph, but I wouldn't be able to know whether the Archive is reachable from the current Deployment or not, so I wouldn't be able to throw the IllegalArgumentException to point that beanClass is not visible to the current Deployment.

Which way should I go? Should I forego the "is beanClass visible to this Deployment" check and follow Ales's suggestion, or should I keep things the way they are?


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/1b2128c5/attachment.html 

More information about the jboss-user mailing list