axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r561552 - /webservices/axis2/branches/java/1_3/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
Date Tue, 31 Jul 2007 21:20:02 GMT
Author: gawor
Date: Tue Jul 31 14:20:01 2007
New Revision: 561552

URL: http://svn.apache.org/viewvc?view=rev&rev=561552
Log:
added two functions to clear the ServiceDescription cache (addresses part of the problem described
in AXIS2-3011)

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

Modified: webservices/axis2/branches/java/1_3/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?view=diff&rev=561552&r1=561551&r2=561552
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
Tue Jul 31 14:20:01 2007
@@ -97,10 +97,10 @@
                     log.debug("ServiceDescription not found in the cache");
                     log.debug(" creating new ServiceDescriptionImpl");
                 }
-                
+
                 ServiceDescriptionImpl serviceDescImpl = new ServiceDescriptionImpl(wsdlURL,
serviceQName, serviceClass);
                 serviceDescImpl.setAxisConfigContext(configContext);
-
+                
                 serviceDesc = serviceDescImpl;
                 if (log.isDebugEnabled()) {
                     log.debug("ServiceDescription created with WSDL URL: " + wsdlURL + ";
QName: " +
@@ -116,6 +116,51 @@
         return serviceDesc;
     }
 
+    /**
+     * Clears the entire ServiceDescription cache.
+     * 
+     * <h4>Note</h4>     
+     * This function might cause unpredictable results when configuration contexts are being
reused
+     * and/or there are outstanding requests using the cached ServiceDescription objects.
Also, 
+     * in-flight requests (both client and server) using ServiceDelegates MUST be done and
out of
+     * scope before this method is called.
+     * 
+     */
+    public static void clearServiceDescriptionCache() {
+        cache.clear();
+    }
+    
+    /**
+     * Clears all the ServiceDescription objects in the cache associated with the specified

+     * configuration context.
+     * 
+     * <h4>Note</h4>
+     * This function should only be used to clear the cache when the specified configuration
context
+     * will not be used anymore and there are no outstanding requests using the associated

+     * ServiceDescription objects. Also, in-flight requests (both client and server) using

+     * ServiceDelegates MUST be done and out of scope before this method is called.     

+     * Otherwise, unpredictable results might occur.
+     * 
+     * @param configContext The configuration context associated with the ServiceDescription

+     *                      objects in the cache.
+     */
+    public static void clearServiceDescriptionCache(ConfigurationContext configContext) {
+        if (configContext == null) {
+            return;
+        }
+        synchronized (configContext) {
+            synchronized (cache) {
+                Iterator<DescriptionKey> iter = cache.keySet().iterator();
+                while (iter.hasNext()) {
+                    DescriptionKey key = iter.next();
+                    if (key.getConfigContext() == configContext) {
+                        iter.remove();
+                    }
+                }
+            }
+        }
+    }    
+    
     /**
      * @see org.apache.axis2.jaxws.description.DescriptionFactory#createServiceDescriptionFromServiceImpl(Class,
      *      AxisService)



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message