[jboss-user] [JBoss Microcontainer Development] - ClassPoolRepository vs JBossclDelegatingClassPoolRepository

Flavia Rainone do-not-reply at jboss.com
Fri Apr 23 08:03:19 EDT 2010

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

"ClassPoolRepository vs JBossclDelegatingClassPoolRepository"

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

> Ales Justin wrote:
> This sounds too much of an impl detail to be left to external (non-Classpool) libs to handle.
> Hence my suggestion is to make this a spi/configuration on Classpool side,
> so users (other libs) don't have to think about it when using it -- they simply use what Classpool provides.
In that case, I assume that the best option is:

> (...) keeping ClassPoolRepository the way it is, getting rid of JBossClDelegatingClassPoolRepository, and having the ClassPoolFactory providing a plugin class containing the extra steps required for classloader registration.
This way, from an external point of view, all you have to do is: always use ClassPoolRepository; inject your ClassPoolFactory into ClassPoolRepository.

I implemented a first version of this as part of issue CLASSPOOL-2, which added to the spi package:
- a new interface, ClassLoaderRegistryHandler, responsible for handling the register and unregister calls in ClassPoolRepository
- a ClassLoaderRegistryHandlerFactory interface, that can be implemented by ClassPoolFactories that require a non-default ClassLoaderRegistryHandlers

That way, ClassPoolRepository.setClassPoolFactory checks for whether the CPFactory implements ClassLoaderRegistryHandlerFactory. If it does, ClassPoolRepository uses the factory to create a new ClassLoaderRegistryHandler for itself.

- JBossClDelegatingClassPoolRepository has been renamed to JBossClRegistryHandler, is no longer a public class, and implements ClassLoaderRegistryHandler
- JBossclDelegatingClassPoolFactory implements ClassLoaderRegistryHandlerFactory so it can provide JBossClRegistryHandler to ClassPoolRepository

Let me know what you think of this implementation and what do you think should be changed/improved.


Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community

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

More information about the jboss-user mailing list