Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.1
    • Component/s: XML
    • Labels:
      None
    • Environment:
      all

      Description

      Our webservices rely heavily on extracting data from xml-messages with xpath.
      The example you give in the reference documentation, chapter 4.2.1 regarding XPathExpression suggests creating an XPathExpression with a factory and inject it into the WebService, that needs the expression.

      In a Java 5.0 environment the implementation of XPathExpression would be Jaxp13XPathExpression (as found here: http://fisheye1.cenqua.com/browse/springframework/spring-projects/spring-ws-core/src/java/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.java?r=1.1), which just delegates to javax.xml.xpath.XPathExpression without any synchronization.
      But the Javadocs for java.xml.xpath.XPathExpression (http://java.sun.com/javase/6/docs/api/javax/xml/xpath/XPathExpression.html) state that this is not thread-safe.
      So multiple concurrent requests into the Webservice with the injected XPathExpression would cleary violate thread-safety.

      The question is, who schould do synchronization. If you suggest, application code should ensure thread-safety, this sould be at least documented in the examples.

      What do you think is the best way to benefit from compiled (fast) XPathExpressions without throttling throuput?

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Well, the only way to make it work is to make XPathExpressions synchronized, I think

        Show
        arjen.poutsma Arjen Poutsma added a comment - Well, the only way to make it work is to make XPathExpressions synchronized, I think
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Actually, if you look in Jaxp13XPathExpressionFactory, you will see that the XPathExpression implementation created already contains a synchronized block, so it is already thread-safe in the current release.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Actually, if you look in Jaxp13XPathExpressionFactory, you will see that the XPathExpression implementation created already contains a synchronized block, so it is already thread-safe in the current release.
        Hide
        soeren.chittka@googlemail.com Sören Chittka added a comment -

        Where can I find the source-code?
        I looked via fisheye (see the URL in my initial post), because I did not want to download everything, but the version I found did not contain any synchronized block, hence my assumption that XPathExpression would not be threadsafe.

        Thanks for pointing this out to me, so I can rely on XPathExpression without any further synchronization.

        Show
        soeren.chittka@googlemail.com Sören Chittka added a comment - Where can I find the source-code? I looked via fisheye (see the URL in my initial post), because I did not want to download everything, but the version I found did not contain any synchronized block, hence my assumption that XPathExpression would not be threadsafe. Thanks for pointing this out to me, so I can rely on XPathExpression without any further synchronization.
        Show
        arjen.poutsma Arjen Poutsma added a comment - Right here: http://static.springframework.org/spring-ws/site/xref/org/springframework/xml/xpath/Jaxp13XPathExpressionFactory.html#110
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.1 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.1 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            soeren.chittka@googlemail.com Sören Chittka
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: