Wherever you are reusing a stub or service client, you should ensure thread safety. So yes, if you are calling stub.getId() from multiple threads, you need to ensure that this call happens within a properly synchronized block. A further design enhancement could include maintaining a pool of stubs, and reusing the stubs.
2012/1/19 Güçlü Akkaya <[email protected]> > > I see. So should i synchronize the initiliazation part which calls a new > instance of stub? > Also the method call of the stub instance like stub.getId() should also be > synchronized? > > Thanks > > > >Please note that by design, Axis2 clients & stubs are not thread safe. You > will have to handle the synchronization in your code. > > Fatih Güçlü Akkaya > > Software Development Engineer > > > > > > > ARDIC ARGE BILGI VE TEKNOLOJI ÇÖZÜMLERI > > APPLIED RESEARCH DEVELOPMENT INNOVATION CENTER > > Tel: + 90 262 642 42 52 > > GSM: + 90 554 542 48 50 > > > > -----Original Message----- > From: [email protected] on behalf of Afkham Azeez > Sent: Thu 1/19/2012 07:37 > To: [email protected] > Subject: Re: [Carbon-dev] IOException on the MTOM web service client side > > Please note that by design, Axis2 clients & stubs are not thread safe. You > will have to handle the synchronization in your code. > > 2012/1/9 Güçlü Akkaya <[email protected]> > > > ** > > > > > > Hi again, > > > > Again for the MTOM web service load test i am facing this exception on > the > > client side: > > > > Failed to perform get operation. > > {com.ardic.arcsp.update.wsclient.WSStorageServiceClient} > > org.apache.axis2.AxisFault: org.apache.axiom.ext.io.StreamCopyException: > > Error reading from source > > at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) > > at > > > com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16706) > > at > > > com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.wSgetById(WSStorageServiceStub.java:6659) > > at > > > com.ardic.arcsp.update.wsclient.WSStorageServiceClient.getResourceById(WSStorageServiceClient.java:171) > > at > > > com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.downloadResource(OTAUpdateTestServlet.java:139) > > at > > > com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.doGet(OTAUpdateTestServlet.java:91) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) > > at > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) > > at > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > > at > > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) > > at > > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) > > at > > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) > > at > > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) > > at > > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) > > at > > org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:241) > > at > > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) > > at > > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) > > at > > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399) > > at > > > org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396) > > at > > > org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356) > > at > > > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > > at java.lang.Thread.run(Thread.java:662) > > Caused by: org.apache.axiom.om.OMException: > > org.apache.axiom.ext.io.StreamCopyException: Error reading from source > > at > > > org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:172) > > at > > org.apache.axiom.attachments.Attachments.getPart(Attachments.java:705) > > at > > > org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:623) > > at > > > org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:350) > > at > > > org.apache.axiom.om.impl.builder.OMAttachmentAccessorMimePartProvider.getDataHandler(OMAttachmentAccessorMimePartProvider.java:45) > > at > > > org.apache.axiom.util.stax.xop.XOPDecodingStreamReader$DataHandlerProviderImpl.getDataHandler(XOPDecodingStreamReader.java:81) > > at > > > org.apache.axiom.util.stax.xop.XOPDecodingStreamReader.getDataHandler(XOPDecodingStreamReader.java:472) > > at > > > org.apache.axiom.om.impl.SwitchingWrapper.getDataHandler(SwitchingWrapper.java:1360) > > at > > > org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:230) > > at > > > com.ardic.arcsp.carbon.registry.ws.stub.xsd.WSResource$Factory.parse(WSResource.java:2087) > > at > > > com.ardic.arcsp.carbon.registry.ws.stub.WSgetByIdResponse$Factory.parse(WSgetByIdResponse.java:417) > > at > > > com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16273) > > ... 23 more > > Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading > from > > source > > at > > > org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114) > > at > > > org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76) > > at > > > org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:136) > > ... 34 more > > Caused by: java.io.IOException: CRLF expected at end of chunk: 2/63 > > at > > > org.apache.commons.httpclient.ChunkedInputStream.readCRLF(ChunkedInputStream.java:207) > > at > > > org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:219) > > at > > > org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:176) > > at java.io.FilterInputStream.read(FilterInputStream.java:116) > > at > > > org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108) > > at java.io.FilterInputStream.read(FilterInputStream.java:116) > > at > > > org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147) > > at java.io.FilterInputStream.read(FilterInputStream.java:116) > > at java.io.PushbackInputStream.read(PushbackInputStream.java:169) > > at > > > org.apache.axiom.attachments.BoundaryPushbackInputStream.readFromStream(BoundaryPushbackInputStream.java:114) > > at > > > org.apache.axiom.attachments.BoundaryPushbackInputStream.read(BoundaryPushbackInputStream.java:248) > > at > > > org.apache.axiom.attachments.MIMEBodyPartInputStream.read(MIMEBodyPartInputStream.java:87) > > at > > > org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112) > > ... 36 more > > > > > > > > The client side for the web service WSStorageService consists of a > servlet > > which used WSStorageClient referenced from the > > org.wso2.carbon.registry.ws.client.WSRegistryServiceClient. In the get > > request the servlet request the resorce file from the web service and the > > end user can download the file. In the attachment you can find both the > > servlet and web service client code. This exception occurs in some cases > > during my load test on the web service. What is the cause of this > > exception? If this related to my code, what do i have to do the avoid > this > > error in my code? > > > > > > > > > > Fatih Güçlü Akkaya > > > > Software Development Engineer > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > Carbon-dev mailing list > > [email protected] > > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev > > > > > > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>** > email: **[email protected]* <[email protected]>* cell: +94 77 3320919 > blog: **http://blog.afkham.org* <http://blog.afkham.org>* > twitter: **http://twitter.com/afkham_azeez*< > http://twitter.com/afkham_azeez> > * > linked-in: **http://lk.linkedin.com/in/afkhamazeez* > * > * > *Lean . Enterprise . Middleware* > > > _______________________________________________ > Carbon-dev mailing list > [email protected] > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev > > -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>** email: **[email protected]* <[email protected]>* cell: +94 77 3320919 blog: **http://blog.afkham.org* <http://blog.afkham.org>* twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware*
_______________________________________________ Carbon-dev mailing list [email protected] http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
