Author: barrettj
Date: Mon Apr 16 11:48:32 2007
New Revision: 529355

URL: http://svn.apache.org/viewvc?view=rev&rev=529355
Log:
AXIS2-2542
Fix contributed by Dustin Amrhein.  The DescriptionFactoryImpl cache and update 
need to be threadsafe.

Modified:
    
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java

Modified: 
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?view=diff&rev=529355&r1=529354&r2=529355
==============================================================================
--- 
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
 Mon Apr 16 11:48:32 2007
@@ -80,35 +80,36 @@
                 log.debug("Description Key = " + key.printKey());
 
         }
-        ServiceDescription serviceDesc = cache.get(key);
-        if (log.isDebugEnabled()) {
-            log.debug("Check to see if ServiceDescription is found in cache");
-        }
-        if (serviceDesc != null) {
+        ServiceDescription serviceDesc = null;
+        synchronized(configContext) {
+            serviceDesc = cache.get(key);
             if (log.isDebugEnabled()) {
-                log.debug("ServiceDescription found in the cache");
-                log.debug(serviceDesc.toString());
+                log.debug("Check to see if ServiceDescription is found in 
cache");
             }
-        }
-        if (serviceDesc == null) {
-            if (log.isDebugEnabled()) {
-                log.debug("ServiceDescription not found in the cache");
-                log.debug(" creating new ServiceDescriptionImpl");
+            if (serviceDesc != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("ServiceDescription found in the cache");
+                    log.debug(serviceDesc.toString());
+                }
             }
+            if (serviceDesc == null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("ServiceDescription not found in the cache");
+                    log.debug(" creating new ServiceDescriptionImpl");
+                }
 
-            serviceDesc = new ServiceDescriptionImpl(wsdlURL, serviceQName, 
serviceClass);
-            if (log.isDebugEnabled()) {
-                log.debug("ServiceDescription created with WSDL URL: " + 
wsdlURL + "; QName: " +
+                serviceDesc = new ServiceDescriptionImpl(wsdlURL, 
serviceQName, serviceClass);
+                if (log.isDebugEnabled()) {
+                    log.debug("ServiceDescription created with WSDL URL: " + 
wsdlURL + "; QName: " +
                         serviceQName + "; Class: " + serviceClass);
-                log.debug(serviceDesc.toString());
-            }
-            if (log.isDebugEnabled()) {
-                log.debug("Caching new ServiceDescription in the cache");
-
+                    log.debug(serviceDesc.toString());
+                }
+                if (log.isDebugEnabled()) {
+                    log.debug("Caching new ServiceDescription in the cache");
+                }
+                cache.put(key, serviceDesc);
             }
-            cache.put(key, serviceDesc);
         }
-
         return serviceDesc;
     }
 
@@ -214,9 +215,12 @@
     public static EndpointDescription updateEndpoint(
             ServiceDescription serviceDescription, Class sei, QName portQName,
             DescriptionFactory.UpdateType updateType) {
-        EndpointDescription endpointDesc =
+        EndpointDescription endpointDesc = null;
+        synchronized(serviceDescription) {
+                endpointDesc = 
                 ((ServiceDescriptionImpl)serviceDescription)
                         .updateEndpointDescription(sei, portQName, updateType);
+        }
         EndpointDescriptionValidator endpointValidator = new 
EndpointDescriptionValidator(endpointDesc);
         
         boolean isEndpointValid = endpointValidator.validate();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to