Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 91399 invoked from network); 31 Jan 2006 19:36:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Jan 2006 19:36:37 -0000 Received: (qmail 42581 invoked by uid 500); 31 Jan 2006 19:36:21 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 42500 invoked by uid 500); 31 Jan 2006 19:36:20 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 42460 invoked by uid 99); 31 Jan 2006 19:36:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2006 11:36:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [128.231.90.117] (HELO NIHCESSMTP3.hub.nih.gov) (128.231.90.117) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2006 11:36:18 -0800 Received: from NIHCESMLBX2.nih.gov ([156.40.71.202]) by NIHCESSMTP3.hub.nih.gov with Microsoft SMTPSVC(6.0.3790.1830); Tue, 31 Jan 2006 14:35:57 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Generated code not Thread safe Date: Tue, 31 Jan 2006 14:35:56 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Generated code not Thread safe Thread-Index: AcYjewB+vY4IOJWPSBGsZWler8Oz9ABtvzfwACLkImAACceP8AAtrL6w From: "Alsarraf, Laheeb \(NIH/OD\) [C]" To: X-OriginalArrivalTime: 31 Jan 2006 19:35:57.0390 (UTC) FILETIME=[8EC90EE0:01C6269D] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I tested that the web service is Not causing the lock. I opened multiple JVMs and ran the same code as simultaneously as I could press the enter button. Below is the thread dump on Windows. The lock happens in org.apache.axis.utils.JavaUtils.java method isEnumClass(): Attribute enumMap is not Thread safe. Maybe Axis should replace HashMap with Hashtable: private static HashMap enumMap =3D new HashMap(); public static boolean isEnumClass(Class cls) { Boolean b =3D (Boolean)enumMap.get(cls); if(b =3D=3D null) { b =3D isEnumClassSub(cls) ? Boolean.TRUE : Boolean.FALSE; enumMap.put(cls, b); } return b.booleanValue(); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Full thread dump Java HotSpot(TM) Client VM (1.4.2_08-b03 mixed mode): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D "Thread-5" prio=3D5 tid=3D0x00a620f8 nid=3D0xb5c runnable = [304f000..304fd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589da0> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Thread-4" prio=3D5 tid=3D0x00a61f78 nid=3D0x848 runnable = [300f000..300fd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589de8> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Thread-3" prio=3D5 tid=3D0x00a84be8 nid=3D0x148 runnable = [2fcf000..2fcfd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589e30> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Thread-2" prio=3D5 tid=3D0x00a84a88 nid=3D0x8ac runnable = [2d7f000..2d7fd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589e78> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Thread-1" prio=3D5 tid=3D0x00a58d00 nid=3D0x914 runnable = [2d3f000..2d3fd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589ec0> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Thread-0" prio=3D5 tid=3D0x00a58ba0 nid=3D0xbb8 runnable = [2cff000..2cffd8c] at java.util.HashMap.get(HashMap.java:325) at org.apache.axis.utils.JavaUtils.isEnumClass(JavaUtils.java:1060) at org.apache.axis.encoding.ser.BeanSerializerFactory.init(BeanSerialize rFactory.java:49) at org.apache.axis.encoding.ser.BeanSerializerFactory.(BeanSeriali zerFactory.java:42) at org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(Base SerializerFactory.java:235) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2315) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.createCall(EUt ilsServiceSoapStub.java:10286) - locked <0x10589f08> (a gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceS oapStub) at gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceSoapStub.run_eSummary(E UtilsServiceSoapStub.java:10513) at gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClient.run(NIHMSClient.java :77) "Signal Dispatcher" daemon prio=3D10 tid=3D0x009fefe8 nid=3D0x81c = waiting on condition [0..0] "Finalizer" daemon prio=3D9 tid=3D0x009fc640 nid=3D0xafc in = Object.wait() [2bbf000..2b bfd8c] at java.lang.Object.wait(Native Method) - waiting on <0x104fa938> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111) - locked <0x104fa938> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=3D10 tid=3D0x009fb2c0 nid=3D0xe00 in Object.wait() [2b 7f000..2b7fd8c] at java.lang.Object.wait(Native Method) - waiting on <0x104fa748> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:429) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115) - locked <0x104fa748> (a java.lang.ref.Reference$Lock) "main" prio=3D5 tid=3D0x00036108 nid=3D0xd34 in Object.wait() = [7f000..7fc38] at java.lang.Object.wait(Native Method) - waiting on <0x104fa750> (a gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSC lient) at java.lang.Thread.join(Thread.java:1001) - locked <0x104fa750> (a gov.nih.nihms.www.soap.nihmssrv1_cgi.NIHMSClien t) at java.lang.Thread.join(Thread.java:1054) at gov.nih.nihms.www.soap.nihmssrv1_cgi.ThreadsTest.main(ThreadsTest.jav a:33) "VM Thread" prio=3D5 tid=3D0x00a3b6e8 nid=3D0x280 runnable "VM Periodic Task Thread" prio=3D10 tid=3D0x00a55fe8 nid=3D0x8dc waiting = on condition "Suspend Checker Thread" prio=3D10 tid=3D0x009fe6a0 nid=3D0xc88 runnable Laheeb Alsarraf -----Original Message----- From: Ferguson, Neil, VF-NZ [mailto:Neil.Ferguson@vodafone.com]=20 Sent: Monday, January 30, 2006 4:59 PM To: axis-user@ws.apache.org Subject: RE: Generated code not Thread safe Hi. You've probably considered this already, but it's worth noting that it may not necessarily be the Axis client that's hanging, but could be the remote service. Have you checked to see whether the call is getting as far as the remote service? (the org.apache.axis.utils.tcpmon tool may be useful for this). Anyway, like Cyrille says, you should try and generate a thread dump (hit CTRL-Break in the JVM in Windows). Neil. -----Original Message----- From: Alsarraf, Laheeb (NIH/OD) [C] [mailto:Alsarral@mail.nih.gov]=20 Sent: Tuesday, 31 January 2006 6:02 a.m. To: axis-user@ws.apache.org Subject: RE: Generated code not Thread safe Neil, I checked out the discussion thread and I do use a new Stub object but the generated code still hangs unless I use Synchronize around my call. Here is the run() method I use in my test class which extends Thread.=20 public void run(){ System.out.println("Starting Thread:" + threadName); try{ EUtilsServiceLocator eUtilService =3D new EUtilsServiceLocator(); EUtilsServiceSoap utils =3D eUtilService.geteUtilsServiceSoap(); ESummaryRequest params =3D new ESummaryRequest(); params.setDb("pubmed"); params.setId(pubMedId); Date startTimeEsum_ =3D new Date(); System.out.println("Thread:" + threadName + ". " + "Calling utils.run_eSummary =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"); // When I use this line as is then the code hangs. ESummaryResult eSummaryRes =3D utils.run_eSummary(params); =20 /* When I replace the above code line with this commented code then the client returns successfully. ObjectLock obj =3D ObjectLock.getInstance(); synchronized(obj) { ESummaryResult eSummaryRes =3D utils.run_eSummary(params); } */ }catch(Exception e){ System.out.println("Exception in Thread:" + threadName + "\n" + e); stop(); } }// End run() Thanks Laheeb Alsarraf -----Original Message----- From: Ferguson, Neil, VF-NZ [mailto:Neil.Ferguson@vodafone.com]=20 Sent: Sunday, January 29, 2006 7:17 PM To: axis-user@ws.apache.org Subject: RE: Generated code not Thread safe Hi. You might find this recent discussion on this mailing helpful: http://marc.theaimsgroup.com/?l=3Daxis-user&m=3D113771126214607&w=3D2 Basically, the generated stub doesn't seem to be thread-safe, but it doesn't seem to be very expensive to create a new stub each time you want one. The service locator does seem to be thread-safe (and is relatively expensive to create), so you can cache this. Hope this helps. Neil. -----Original Message----- From: Alsarraf, Laheeb (NIH/OD) [C] [mailto:Alsarral@mail.nih.gov]=20 Sent: Saturday, 28 January 2006 8:51 a.m. To: axis-user@ws.apache.org Subject: Generated code not Thread safe Hello, =20 I have used axis 1.1.2 and axis 1.1.3 to generate client code for a web service. I tested the generated code for multithreading and the program deadlocks. I added "Synchronized" keyword in the method createCall() of the generated code and that solved the problem. =20 Has anyone had thread safety problems with web service client code generated using axis. =20 Here is the command I use to generate the code: =20 java -cp %AXISCP% org.apache.axis.wsdl.WSDL2Java --timeout -1 %* =20 =20 Thanks =20 Laheeb Alsarraf =20 ------------------------------------------------------------------------ ----------------------- Have you seen our website?.... http://www.vodafone.co.nz Manage Your Account, check your Vodafone Mail and send web2TXT online: http://www.vodafone.co.nz/myvodafone CAUTION: This correspondence is confidential and intended for the named recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you. Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited. Vodafone New Zealand Limited 20 Viaduct Harbour Avenue, Private Bag 92161, Auckland 1030 Telephone + 64 9 355 2000 Facsimile + 64 9 355 2001 ------------------------------------------------------------------------ ----------------------- Have you seen our website?.... http://www.vodafone.co.nz Manage Your Account, check your Vodafone Mail and send web2TXT online: http://www.vodafone.co.nz/myvodafone CAUTION: This correspondence is confidential and intended for the named recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you. Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited. Vodafone New Zealand Limited 20 Viaduct Harbour Avenue, Private Bag 92161, Auckland 1030 Telephone + 64 9 355 2000 Facsimile + 64 9 355 2001