[ 
https://issues.apache.org/jira/browse/MUSE-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525248
 ] 

Vinh Nguyen commented on MUSE-270:
----------------------------------

The following updates fix the multi-thread notifications issue for me:

1) Updated EndpointReference.java.  Changed all XmlUtils.EMPTY_DOC references 
to XmlUtil.createDocument().  This is because a resource's EPR and its Element 
representation can be accessed from multiple threads.

2) Updated SimpleNotificationMessage.toXML().  Changed XmlUtils.EMPTY_DOC 
reference to XmlUtils.createDocument().  This is because 
EndpointReference.toXML(Document) creates an Element and 
XmlUtils.getAllNamespaces(root) is called on it.

3) Updated NotificationConsumerClient.notify(NotificationMessage[] messages) to 
not assume that messages[x].toXML() will return an Element whose owner is 
EMPTY_DOC.
Changed these lines:
        Element notify = XmlUtils.createElement(WsnConstants.NOTIFY_QNAME);     
   
        for (int n = 0; n < messages.length; ++n)
            notify.appendChild(messages[n].toXML(), true);
To these lines:
        Document doc = XmlUtils.createDocument();
        Element notify = XmlUtils.createElement(doc, WsnConstants.NOTIFY_QNAME);
        for (int n = 0; n < messages.length; ++n)
            notify.appendChild(doc.importNode(messages[n].toXML(), true));



> EMPTY_DOC thread stability issues
> ---------------------------------
>
>                 Key: MUSE-270
>                 URL: https://issues.apache.org/jira/browse/MUSE-270
>             Project: Muse
>          Issue Type: Bug
>          Components: Utilities - General, QName, and XML, WS-Addressing and 
> SOAP
>    Affects Versions: 2.0.0 M1, 2.0.0 M2, 2.0.0, 2.1.0, 2.2.0, 2.3.0
>         Environment: Impacts all platforms and configurations
>            Reporter: Rich Lucente
>            Assignee: Dan Jemiolo
>             Fix For: 2.3.0
>
>         Attachments: epr-tests.zip
>
>
> This bug is being opened to track the EMPTY_DOC thread stability issue 
> currently being discussed on the muse-dev mailing list.  XmlUtils provides 
> EMPTY_DOC as a scratchpad instance of a DOM Document for creation of 
> elements.  This has been shown to cause exceptions in a multi-threaded 
> environment.  The issue is compounded by the widespread use of EMPTY_DOC in 
> the code due to its convenience and the reduction in object creation when 
> constructing XML fragments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to