JBoss Community

Re: Implementing a non-flat deployment for Weld Integration

created by Ales Justin in JBoss Microcontainer Development POJO Server - View the full discussion

Flavia Rainone wrote:

 

IMO, I would move the initialization of default domain to a static block. In this block, I would also add the lib Archives after the default domain is created:
- we know that ClasspathFactory will be loaded only when it is needed. At the time ClasspathFactory is loaded, hence, it is because we are on a deploy process and it means that we will need default domain, so no gain in initializing DefaultClasspath inside of getClasspath
- if the libraries are loaded after ClasspathFactory, we won't enter the loop
- if the libraries are loaded in a static block, we know that nobody is using ClasspathFactory, so we know nobody will get his hands on a DefaultClasspath that lacks the lib Archives
- you get rid of the synchronized (DefaultDomain) block. No need to synchronize just to return something that is already initialized. As almost every request to create a classpath will recursively enter this block, this is a nice thing

Regardless of whether you decide to move it to a static block, which is personal choice, if you load the DefaultClasspath prior to creating the lib archives, you will get rid of the infinite loop. The reason for this is that ArchiveInfo transparently creates a Classpath to represent the associated ClassLoader domain.

Reply to this message by going to Community

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