SpringWS Plugin

DefaultEndpointAdapter is not threadsafe

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: Grails-SpringWS 0.2
  • Fix Version/s: Grails-SpringWS 0.2.1
  • Component/s: None
  • Labels:
    None

Description

From an original patch from Okke Tijhuis:

When you get a lot of simultaneous request (tested with SoapUI with multiple threads) the xml messages
get garbled when the messages are transformed. It looks like the transformer class isn't threadsafe.

Original code:

public class DefaultEndpointAdapter extends AbstractEnpointAdapter {
private final Transformer transformer

public DefaultEndpointAdapter() { this.transformer = TransformerFactory.newInstance().newTransformer() }

protected Object createRequest(Source request) throws Exception { StringResult result = new StringResult() transformer.transform(request, result) return new XmlSlurper().parseText(result.toString()) }

protected Writer createResponseWriter() { return new StringWriter() }

protected Object createResponse(Writer writer) { return new MarkupBuilder(writer) }
}


When I change the code to the following the problem is gone:

public class DefaultEndpointAdapter extends AbstractEnpointAdapter {
private final TransformerFactory factory

public DefaultEndpointAdapter() { this.factory = TransformerFactory.newInstance() }

protected Object createRequest(Source request) throws Exception { Transformer transformer = factory.newTransformer() StringResult result = new StringResult() transformer.transform(request, result) return new XmlSlurper().parseText(result.toString()) }

protected Writer createResponseWriter() { return new StringWriter() } }

protected Object createResponse(Writer writer) { return new MarkupBuilder(writer) }
}

Activity

Hide
Russ Miles added a comment -

Patched in release 0.2.1

Show
Russ Miles added a comment - Patched in release 0.2.1
Hide
Russ Miles added a comment -

Closed issue as fixed in 0.2.1 release.

Show
Russ Miles added a comment - Closed issue as fixed in 0.2.1 release.

People

Vote (0)
Watch (0)

Dates

  • Due:
    Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
3d
Original Estimate - 3 days
Remaining:
3d
Remaining Estimate - 3 days
Logged:
Not Specified
Time Spent - Not Specified