As Willem mentioned, this is definitely not thread safe using the default setups.
With 2.1, we have new Factories that can be used to help these cases. The "default" is a SingleInstance thing where you would need to be concerned with thread safety. However, you will be able to configure a "pool" of instances where a single object is used to service the request, then returned back to the pool. Some of it is talked about in the thread: http://www.nabble.com/WebServiceContext-not-injected-in-endpoint-to15708465.html#a15732342 Dan On Saturday 01 March 2008, Landslide wrote: > Is it thread safe to use an instance variable "quote" as below? > > import javax.xml.ws.Provider; > import javax.xml.ws.Service; > import javax.xml.ws.ServiceMode; > import javax.xml.ws.WebServiceProvider; > > @WebServiceProvider(portName="stockQuoteReporterPort" > serviceName="stockQuoteReporter") > @ServiceMode(value="Service.Mode.MESSAGE") > public class StockQuoteReporterProvider implements > Provider<SOAPMessage> { > private Quote quote; > > public StockQuoteReporterProvider() > { > quote = new Quote(); > } > > public SOAPMessage invoke(SOAPMessage request) > { > quote.setIntProperty(123); > > SOAPBody requestBody = request.getSOAPBody(); > if(requestBody.getElementName.getLocalName.equals("getStockPrice")) > { > MessageFactory mf = MessageFactory.newInstance(); > SOAPFactory sf = SOAPFactory.newInstance(); > > SOAPMessage response = mf.createMessage(); > SOAPBody respBody = response.getSOAPBody(); > Name bodyName = sf.createName("getStockPriceResponse"); > respBody.addBodyElement(bodyName); > SOAPElement respContent = respBody.addChildElement("price"); > respContent.setValue("123.00"); > response.saveChanges(); > return response; > } > ... > } > } -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
