<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: META-INF/services for module extensions - question/issue
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/brian.stansberry">Brian Stansberry</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/625600#625600">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>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. <span> :) </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p>Dan Sirbu wrote:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  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.</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Sounds like you're in the same boat we are in. <span> :) </span> 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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/625600#625600">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>