<!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">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;">
    XTS tests broken in AS trunk after switch to CXF stack in 3.3.0
</h3>
<span style="margin-bottom: 10px;">
    reply from <a href="http://community.jboss.org/people/adinn">Andrew Dinn</a> in <i>JBoss Web Services CXF</i> - <a href="http://community.jboss.org/message/547327#547327">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Ok, I wrote a little byteman script to trace calls to EndpointAssociation.setEndpoint and EndpointAssociation.getEndpoint:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;"># rules to track calls to getEndpoint and setEndpoint in CXF code<br/>#<br/><br/>RULE trace setEndpoint<br/>CLASS EndpointAssociation<br/>METHOD setEndpoint<br/>IF TRUE<br/>DO trace("foo", "setEndpoint(" + $1.getName() + ")\n" + formatStack())<br/>ENDRULE<br/><br/>RULE trace getEndpoint<br/>CLASS EndpointAssociation<br/>METHOD getEndpoint<br/>AT RETURN<br/>IF TRUE<br/>DO trace("foo", "getEndpoint() ==&gt; " + $!.getName() + "\n" + formatStack())<br/>ENDRULE</span></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When I ran my tests with&#160; this script installed I got a few cases where successive gets and sets were using different endpoints. Here is a dump of the (filtered and reformatted) trace output:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;">setEndpoint(Interop11ATParticipantService)<br/>Stack trace for thread http-127.0.0.1-8080-3<br/>getEndpoint() ==&gt; Interop11ATParticipantService<br/>Stack trace for thread default-workqueue-1&#160;&#160;&#160;&#160;&#160; // n.b. worker 1 from participant executor<br/><br/>setEndpoint(ActivationService)<br/>Stack trace for thread http-127.0.0.1-8080-4<br/>getEndpoint() ==&gt; ActivationService<br/>Stack trace for thread http-127.0.0.1-8080-4</span></p><p><span style="font-family: courier new,courier;"><br/></span></p><p><span style="font-family: courier new,courier;">setEndpoint(RegistrationService)<br/>Stack trace for thread http-127.0.0.1-8080-4<br/>getEndpoint() ==&gt; RegistrationService<br/>Stack trace for thread http-127.0.0.1-8080-4<br/><br/>setEndpoint(CompletionCoordinator)<br/>Stack trace for thread http-127.0.0.1-8080-4<br/>getEndpoint() ==&gt; CompletionCoordinator<br/>Stack trace for thread default-workqueue-1<br/><br/>setEndpoint(CompletionInitiator)<br/>Stack trace for thread http-127.0.0.1-8080-5<br/>getEndpoint() ==&gt; CompletionInitiator<br/>Stack trace for thread default-workqueue-2</span> <span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; // n.b. worker 2 from initiator executor</span></p><p><span style="font-family: courier new,courier;"><br/>setEndpoint(Interop11ATInitiatorService)<br/>Stack trace for thread http-127.0.0.1-8080-6<br/>getEndpoint() ==&gt; Interop11ATInitiatorService<br/>Stack trace for thread default-workqueue-2<br/></span></p><p><span style="font-family: courier new,courier;"><br/></span></p><p><span style="font-family: courier new,courier;">. . .<br/></span></p><p><span style="font-family: courier new,courier;"><br/></span></p><p><span style="font-family: courier new,courier;"><span style="font-family: courier new,courier;">setEndpoint(RegistrationService)<br/></span>Stack trace for thread http-127.0.0.1-8080-9<br/>getEndpoint() ==&gt; RegistrationService<br/>Stack trace for thread http-127.0.0.1-8080-9<br/><br/>setEndpoint(RegistrationService)<br/>Stack trace for thread http-127.0.0.1-8080-9<br/>getEndpoint() ==&gt; RegistrationService<br/>Stack trace for thread http-127.0.0.1-8080-9<br/><br/>setEndpoint(Interop11ATInitiatorService)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // hmm, call is to initiator service<br/>Stack trace for thread http-127.0.0.1-8080-9<br/>getEndpoint() ==&gt; Interop11ATParticipantService<br/>Stack trace for thread default-workqueue-1&#160;&#160;&#160;&#160;&#160;&#160; // oops wrong worker and endpoint!<br/></span></p><p><span style="font-family: courier new,courier;"><span style="font-family: courier new,courier;"><br/>setEndpoint(ActivationService)<br/>Stack trace for thread http-127.0.0.1-8080-9<br/>getEndpoint() ==&gt; ActivationService<br/>Stack trace for thread http-127.0.0.1-8080-9<br/><br/>setEndpoint(Interop11ATParticipantService)&#160;&#160;&#160;&#160;&#160;&#160; // hmm, call is participant service<br/>Stack trace for thread http-127.0.0.1-8080-5<br/>getEndpoint() ==&gt; Interop11ATInitiatorService<br/>Stack trace for thread default-workqueue-2&#160;&#160;&#160;&#160;&#160;&#160; // wrong worker and endpoint again!<br/><br/>setEndpoint(ActivationService)<br/>Stack trace for thread http-127.0.0.1-8080-5<br/>getEndpoint() ==&gt; ActivationService<br/>Stack trace for thread http-127.0.0.1-8080-5<br/><br/>setEndpoint(Interop11ATParticipantService)<br/>Stack trace for thread http-127.0.0.1-8080-8<br/>getE</span>ndpoint() ==&gt; Interop11ATParticipantService<br/>Stack trace for thread default-workqueue-3</span></p><p><span style="font-family: courier new,courier;">. . .</span></p></blockquote><p>So, worker thread 1 was added under a call to the participant service and hence has this endpoint in its inherited therad local. However it appears to get reused to handle the initiator calls later. How so? I added some trace rules to see what exector was being used:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;"> . .<br/></span></p><p><span style="font-family: courier new,courier;">setEndpoint(jboss.ws:context=interop11,endpoint=Interop11ATParticipantService)<br/>Stack trace for thread http-127.0.0.1-8080-3<br/>getExecutor() ==&gt; org.apache.cxf.workqueue.AutomaticWorkQueueImpl@16c8373 [queue size: 0, max size: 256, threads: 0, active threads: 0, low water mark: 5, high water mark: 25]<br/>Stack trace for thread http-127.0.0.1-8080-3<br/>getEndpoint() ==&gt; jboss.ws:context=interop11,endpoint=Interop11ATParticipantService<br/>Stack trace for thread default-workqueue-1</span></p><p><span style="font-family: courier new,courier;">. . .<br/></span></p><p><span style="font-family: courier new,courier;">setEndpoint(jboss.ws:context=interop11,endpoint=Interop11ATInitiatorService)<br/>Stack trace for thread http-127.0.0.1-8080-6<br/>getExecutor() ==&gt; org.apache.cxf.workqueue.AutomaticWorkQueueImpl@16c8373 [queue size: 0, max size: 256, threads: 1, active threads: 1, low water mark: 5, high water mark: 25]<br/>Stack trace for thread http-127.0.0.1-8080-6<br/>getEndpoint() ==&gt; jboss.ws:context=interop11,endpoint=Interop11ATInitiatorService<br/>Stack trace for thread default-workqueue-2<br/>setEndpoint(jboss.ws:context=interop11,endpoint=Interop11ATParticipantService)<br/>Stack trace for thread http-127.0.0.1-8080-3<br/>getExecutor() ==&gt; org.apache.cxf.workqueue.AutomaticWorkQueueImpl@16c8373 [queue size: 0, max size: 256, threads: 2, active threads: 0, low water mark: 5, high water mark: 25]<br/>Stack trace for thread http-127.0.0.1-8080-3<br/>getEndpoint() ==&gt; jboss.ws:context=interop11,endpoint=Interop11ATParticipantService<br/>Stack trace for thread default-workqueue-3</span></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I added some more trace rules to see what is going on inside getExecutor:</p><blockquote class="jive-quote"><pre jivemacro="quote"><p>RULE trace getExecutor<br/>CLASS ContextUtils<br/>METHOD getExecutor<br/>AT RETURN<br/>IF TRUE<br/>DO traceln("foo", "getExecutor() ==&gt; " + $!)<br/>ENDRULE</p></pre>
<p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p>
<p><span style="font-family: courier new,courier;">RULE trace getExecutor internal<br/>CLASS ContextUtils<br/>METHOD getExecutor<br/>AFTER CALL getNamedWorkQueue<br/>IF TRUE<br/>DO traceln("foo", "getExecutor called getNamedWorkQueue")<br/>ENDRULE<br/><br/>RULE trace getExecutor internal 2<br/>CLASS ContextUtils<br/>METHOD getExecutor<br/>AFTER CALL getAutomaticWorkQueue<br/>IF TRUE<br/>DO traceln("foo", "getExecutor called getAutomaticWorkQueue")<br/>ENDRULE<br/><br/>RULE trace getExecutor internal 3<br/>CLASS ContextUtils<br/>METHOD getExecutor<br/>AFTER CALL getInstance<br/>IF TRUE<br/>DO traceln("foo", "getExecutor called getInstance")<br/>ENDRULE</span></p>
</blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This first rule prints the return value on the stack ($!) when getExecutor is about to return i.e. at the point where the original handler thread is queueing the runnable to execute the handed off message. The trace output reveals that the same executor is being used for both endpoints.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This appears to be because an executor is created per service. When the service has multiple endpoints then threads added to the pool can inherit an endpont at create but later be given jobs to run which are associated with one of&#160; the other endpoints.</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/547327#547327">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services CXF at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2046">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>