[jboss-dev-forums] [JBoss AS7 Development] - Re: META-INF/services for module extensions - question/issue
Brian Stansberry
do-not-reply at jboss.com
Thu Sep 8 15:09:04 EDT 2011
Brian Stansberry [http://community.jboss.org/people/brian.stansberry] created the discussion
"Re: META-INF/services for module extensions - question/issue"
To view the discussion, visit: http://community.jboss.org/message/625600#625600
--------------------------------------------------------------
We're definitely getting on the same page, and I'm glad we're discussing in detail; it's worthwhile for me, hopefully for you, hopefully for others who may read this. :)
Jason's already pointed out that 7.0.2 should solve the practical issue. We've made the caller setting the TCCL a part of the contract of the Extension interface.
A lot of the rest of what I've said and what David has said is more oriented toward best practices and such. One thing the AS7 team has encountered a lot in the course of developing AS 7 is frameworks (some of which we helped write sometime in the past) that make assumptions about what the TCCL will be in the absence of a contract. So we're always trying to spread the word about being careful about making that assumption.
> Dan Sirbu wrote:
>
> Now - if you ask me to add a second argument to ServiceLoader in Module#1 - then there is a no go - because Module#1 may be a 3rd party product that I cannot change, as example. Thus the ServiceLoader.load with one argument is the only option that can be available.
Sounds like you're in the same boat we are in. :) You have unknown code that you are calling into that is making assumptions about the TCCL. In this case before calling into it you can set the TCCL to the correct classloader, hopefully one defined in the ServiceAPIClass contract. That could very well be the defining classloader for Module#1's impl of the service interface.
The classloader for the ModuleExtension module, which in 7.0.2 will be the TCCL, may not have visibility to classes in Module#2. That's the nature of modular classloading -- the intent is to provide proper isolation, and not to expose everything to everybody. So if you think Module#1 is going to be relying on the TCCL having visibility to everything Module#1 depends on, then you should set the TCCL to a classloader that should have that visibility. Most likely that is Module#1's classloader.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625600#625600]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110908/3a381ca6/attachment.html
More information about the jboss-dev-forums
mailing list