You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2008/02/13 23:16:35 UTC

svn commit: r627600 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ metadata/src/org/apache/axis2/jaxws/description/builder/converter/ metadata/src/org/apache/axis2/jaxws/description/impl/

Author: scheu
Date: Wed Feb 13 14:16:28 2008
New Revision: 627600

URL: http://svn.apache.org/viewvc?rev=627600&view=rev
Log:
AXIS2-3508
Contributor:Rich Scheuerle
Use a ConcurrentHashMap for the RuntimeServiceDescriptions.
Added some minor J2S stuff.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java?rev=627600&r1=627599&r2=627600&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java Wed Feb 13 14:16:28 2008
@@ -65,7 +65,7 @@
     }
 
     static public String getKey(Class implClass) {
-        return "Resource Injection:" + implClass.getCanonicalName();
+        return implClass.getCanonicalName();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java?rev=627600&r1=627599&r2=627600&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java Wed Feb 13 14:16:28 2008
@@ -46,6 +46,7 @@
 import org.apache.axis2.jaxws.description.builder.WebServiceAnnot;
 import org.apache.axis2.jaxws.description.builder.WebServiceProviderAnnot;
 import org.apache.axis2.jaxws.description.builder.WebServiceRefAnnot;
+import org.apache.axis2.jaxws.util.ClassLoaderUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -123,7 +124,7 @@
      */
     private void introspectClass(DescriptionBuilderComposite composite) {
         // Need to investigate this, probably want to specify
-        composite.setClassLoader(serviceClass.getClassLoader());
+        composite.setClassLoader(ClassLoaderUtils.getClassLoader(serviceClass));
         composite.setIsInterface(serviceClass.isInterface());
         composite.setSuperClassName(serviceClass.getSuperclass() != null ? serviceClass.
                 getSuperclass().getName() : null);

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=627600&r1=627599&r2=627600&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Wed Feb 13 14:16:28 2008
@@ -1310,7 +1310,8 @@
 
                 // REVIEW: This is using the classloader for EndpointDescriptionImpl; is that OK?
                 ClassLoader classLoader = (composite.isServiceProvider() && !composite.isDeprecatedServiceProviderConstruction()) ?
-                        composite.getClassLoader() : this.getClass().getClassLoader();
+                        composite.getClassLoader() : 
+                            this.getClass().getClassLoader();
 
                 InputStream is = DescriptionUtils.openHandlerConfigStream(
                         handlerFileName,
@@ -1330,7 +1331,7 @@
             		log.debug("Loading handlers from provided source");
             	}
             	handlerChainsType = DescriptionUtils.loadHandlerChains(handlerChainSource,
-                                                          this.getClass().getClassLoader());
+                                                                   this.getClass().getClassLoader());
             }
         }
         return handlerChainsType;

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=627600&r1=627599&r2=627600&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Wed Feb 13 14:16:28 2008
@@ -18,6 +18,9 @@
  */
 package org.apache.axis2.jaxws.description.impl;
 
+import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_FUTURE;
+import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_RESPONSE;
+
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
@@ -33,8 +36,6 @@
 import org.apache.axis2.jaxws.description.ServiceRuntimeDescription;
 import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
 import org.apache.axis2.jaxws.description.builder.MDQConstants;
-import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_FUTURE;
-import static org.apache.axis2.jaxws.description.builder.MDQConstants.RETURN_TYPE_RESPONSE;
 import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
 import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
 import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
@@ -54,6 +55,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceClient;
 import javax.xml.ws.soap.SOAPBinding;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -66,12 +68,12 @@
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /** @see ../ServiceDescription */
@@ -107,10 +109,13 @@
     private DescriptionBuilderComposite composite = null;
     private boolean isServerSide = false;
 
-//  RUNTIME INFORMATION
+    // RUNTIME INFORMATION
     Map<String, ServiceRuntimeDescription> runtimeDescMap =
-            Collections.synchronizedMap(new HashMap<String, ServiceRuntimeDescription>());
+            new ConcurrentHashMap<String, ServiceRuntimeDescription>();
+            //Collections.synchronizedMap(new HashMap<String, ServiceRuntimeDescription>());
 
+    
+    
 
     /**
      * Create a service-requester side (aka client-side) service description.
@@ -160,7 +165,7 @@
         // The classloader was originally gotten off this class, but it seems more logical to 
         // get it off the application service class.
 //        composite.setClassLoader(this.getClass().getClassLoader());
-        composite.setClassLoader(serviceClass.getClassLoader());
+        composite.setClassLoader(getClassLoader(serviceClass));
         composite.setSparseComposite(sparseCompositeKey, sparseComposite);
         
         // If there's a WSDL URL specified in the sparse composite, that is a override, for example
@@ -1729,7 +1734,8 @@
                 }
                 else {
                     handlerChainsType =
-                        DescriptionUtils.loadHandlerChains(is, this.getClass().getClassLoader());
+                        DescriptionUtils.loadHandlerChains(is, 
+                              getClassLoader(this.getClass()));
                 }
             }
         }
@@ -1875,12 +1881,10 @@
     }
 
     public ServiceRuntimeDescription getServiceRuntimeDesc(String name) {
-        // TODO Add toString support
         return runtimeDescMap.get(name);
     }
 
     public void setServiceRuntimeDesc(ServiceRuntimeDescription srd) {
-        // TODO Add toString support
         runtimeDescMap.put(srd.getKey(), srd);
     }
     
@@ -2020,6 +2024,26 @@
         } catch (PrivilegedActionException e) {
             if (log.isDebugEnabled()) {
                 log.debug("Exception thrown from AccessController: " + e.getMessage(), e);
+            }
+            throw ExceptionFactory.makeWebServiceException(e.getException());
+        }
+
+        return cl;
+    }
+    
+    private static ClassLoader getClassLoader(final Class cls) {
+        ClassLoader cl = null;
+        try {
+            cl = (ClassLoader) AccessController.doPrivileged(
+                    new PrivilegedExceptionAction() {
+                        public Object run() throws ClassNotFoundException {
+                            return cls.getClassLoader();
+                        }
+                    }
+            );
+        } catch (PrivilegedActionException e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Exception thrown from AccessController: " + e);
             }
             throw ExceptionFactory.makeWebServiceException(e.getException());
         }



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