Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 10:41:34 -0400 (Mon, 20 Jul 2009)
New Revision: 10359
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
Log:
[JBPAPP-2105] Concurrency issues where multiple threads create Port using Service
Simultaneously.
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-07-20
13:53:37 UTC (rev 10358)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-07-20
14:41:34 UTC (rev 10359)
@@ -175,7 +175,7 @@
// com/sun/ts/tests/jaxws/api/javax_xml_ws/Service#GetPort1NegTest1WithWsdl
EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName);
- if (serviceMetaData.getEndpoints().size() > 0 && epMetaData == null)
+ if (epMetaData == null && serviceMetaData.getEndpoints().size() > 0)
throw new WebServiceException("Cannot get port meta data for: " +
portName);
// This is the case when the service could not be created from wsdl
@@ -258,9 +258,15 @@
// Adjust the endpoint meta data according to the annotations
if (annotatedPorts.contains(portName) == false)
{
- JAXWSClientMetaDataBuilder metaDataBuilder = new JAXWSClientMetaDataBuilder();
- metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass);
- annotatedPorts.add(portName);
+ synchronized (epMetaData)
+ {
+ if (annotatedPorts.contains(portName) == false)
+ {
+ JAXWSClientMetaDataBuilder metaDataBuilder = new
JAXWSClientMetaDataBuilder();
+ metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass);
+ annotatedPorts.add(portName);
+ }
+ }
}
return (T)createProxy(seiClass, epMetaData);