Description
Sören Chittka opened SWS-189 and commented
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?
Affects: 1.0