Having played with the MC classloading mechanism and its notion of domain, there is something I don't understand.
The notion of domains seems to be there to allow visibility of classes without having to declare any specific dependencies (requirements/capabilities declarations).
Now, if I declare the requirements/capabilities of a module, I would have expected this to work accross domains. But, as far as I can tell, this is not the case (for example, if I load an implementation into a specific domain that uses a different parent, then that implementation cannot access anything that would have been loaded in the DefaultDomain even if the requirements/capabilities declaration were to match).
But then I wonder: What's the point of declaring requirement/capabilities if I can see all of the domain's classes as soon as they are in the same domain? (especially as it seems they will never be visible unless they are part of the same domain/parent domain hierarchy)
I also wonder what is the role of the 'import-all="false"' attribute. I was thinking that would mean I would not see the classes of my domain (and parent domain) unless I declare my dependency via the requirement element. But to be honest I can't see its effects.
I feel that the domain concept is a good idea as it allows a transition to a more OSGi like solution (allowing to put things in common without having to declare anything).
However, I feel it would be more powerful, if the requirement/capabilties information was used to fill dependencies accross domains. It would also be more powerfull if the import-all (which I currently see as some kind of OSGi / non-OSGi mode toggle) was really working (I mean for the scenario where we look at things inside a specific domain).
At the moment, the requirement/capability mechanism seems to be only a sanity check. But if it was really used by the classloading mechanism to know how to link things, then I feel it would be a lot more useful (and powerful).
I was even wondering if allowing something like follows would be an idea:
<package name="my.isolated.infinispan.instance" domain="The_Domain_Where_It_Has_Been_Isolated/>
But I suspect this could well be going too far: Matching the requirements/capabilities should be enough. And even if something is available in multiple domains it should not matter (we already can specify which version we depend on, which should probably be enough).
Or have I misunderstood the whole mechanism?