axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r643229 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: framework/JAXWSDeployer.java message/databinding/JAXBUtils.java server/JAXWSMessageReceiver.java
Date Tue, 01 Apr 2008 00:29:28 GMT
Author: dims
Date: Mon Mar 31 17:29:26 2008
New Revision: 643229

URL: http://svn.apache.org/viewvc?rev=643229&view=rev
Log:
Problem #1: SERVICE_TCCL is very expensive
Problem #2: When the jaxws-calculator sample throws the business exception TCCL is not picked
up, so we get JAXBException saying AddressingException class not found in context
Problem #3: We keep creating JAXBContexts / key to innerMap is wrong

HACK - If we don't find the classes in the specified TCCL class loader then we look into the
cached class loader set in the deployer.


Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java?rev=643229&r1=643228&r2=643229&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
Mon Mar 31 17:29:26 2008
@@ -291,7 +291,7 @@
             axisService.setElementFormDefault(false);
             axisService.setFileName(serviceLocation);
             axisService.setClassLoader(classLoader);
-            axisService.addParameter(new Parameter(Constants.SERVICE_TCCL, Constants.TCCL_COMPOSITE));
+            axisService.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
classLoader));
         }
         return axisService;
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?rev=643229&r1=643228&r2=643229&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Mon Mar 31 17:29:26 2008
@@ -162,8 +162,10 @@
         		if(innerMap==null) {
         			adjustPoolSize(jaxbMap);
         			innerMap = new ConcurrentHashMap<String, JAXBContextValue>();
-        			jaxbMap.put(cl, innerMap);
-        		}
+                    if(cacheKey != null) {
+                        jaxbMap.put(cacheKey, innerMap);
+                    }
+                }
         	}
         }
 
@@ -185,8 +187,14 @@
         			
         			TreeSet<String> validContextPackages = new TreeSet<String>(contextPackages);
 
         			contextValue = createJAXBContextValue(validContextPackages, cl);
-        			
-        			// Put the new context in the map keyed by both the original and valid list of
packages
+                    
+                    // If we don't get all the classes, try the cached classloader 
+                    if (cacheKey != null && validContextPackages.size() != contextPackages.size())
{
+                        validContextPackages = new TreeSet<String>(contextPackages);
+                        contextValue = createJAXBContextValue(validContextPackages, cacheKey);
+                    }
+
+                    // Put the new context in the map keyed by both the original and valid
list of packages
         			String validPackagesKey = validContextPackages.toString();
         			innerMap.put(key, contextValue);
         			innerMap.put(validPackagesKey, contextValue);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?rev=643229&r1=643228&r2=643229&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
Mon Mar 31 17:29:26 2008
@@ -20,7 +20,6 @@
 package org.apache.axis2.jaxws.server;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.AxisOperation;
@@ -56,34 +55,20 @@
  * The JAXWSMessageReceiver is the entry point, from the server's perspective, to the JAX-WS
code.
  * This will be called by the Axis Engine and is the end of the chain from an Axis2 perspective.
  */
-public class JAXWSMessageReceiver extends AbstractMessageReceiver implements MessageReceiver
{
+public class JAXWSMessageReceiver implements MessageReceiver {
 
     private static final Log log = LogFactory.getLog(JAXWSMessageReceiver.class);
 
     private static String PARAM_SERVICE_CLASS = "ServiceClass";
     public static String PARAM_BINDING = "Binding";
 
-    protected void invokeBusinessLogic(org.apache.axis2.context.MessageContext messageCtx)
throws AxisFault {
-        // DUMMY.
-    }
-
-    public void receive(org.apache.axis2.context.MessageContext messageCtx)
-            throws AxisFault {
-        ThreadContextDescriptor tc = setThreadContext(messageCtx);
-        try {
-            receiveInternal(messageCtx);    
-        } finally {
-            restoreThreadContext(tc);
-        }
-    }
-    
     /**
      * We should have already determined which AxisService we're targetting at this point.
 So now,
      * just get the service implementation and invoke the appropriate method.
      * @param axisRequestMsgCtx
      * @throws org.apache.axis2.AxisFault
      */
-    public void receiveInternal(org.apache.axis2.context.MessageContext axisRequestMsgCtx)
+    public void receive(org.apache.axis2.context.MessageContext axisRequestMsgCtx)
             throws AxisFault {
         AxisFault faultToReturn = null;
 
@@ -113,9 +98,8 @@
                 ServiceDescription serviceDesc =
                         DescriptionFactory.createServiceDescriptionFromServiceImpl(
                                 clazz, service);
-                if (service.getParameter(org.apache.axis2.Constants.SERVICE_TCCL) != null)
{
-                    service.addParameter(new Parameter(org.apache.axis2.Constants.SERVICE_TCCL,
org.apache.axis2.Constants.TCCL_COMPOSITE));
-                }
+                service.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,

+                        service.getClassLoader()));
             } catch (ClassNotFoundException e) {
                 throw new RuntimeException(
                         Messages.getMessage("JAXWSMessageReceiverNoServiceClass"));
@@ -141,7 +125,11 @@
             MessageContext requestMsgCtx = new MessageContext(axisRequestMsgCtx);
             requestMsgCtx.setServer(true);
             requestMsgCtx.setMEPContext(new MEPContext(requestMsgCtx));
-            
+            ClassLoader loader = getCachedClassLoader(axisRequestMsgCtx);
+            if (loader != null) {
+                requestMsgCtx.setProperty(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
+                        loader);
+            }
             // The adapters need to be installed on the new request Message Context
             AttachmentsAdapter.install(requestMsgCtx);
             TransportHeadersAdapter.install(requestMsgCtx);
@@ -187,7 +175,10 @@
                 MessageContext responseMsgCtx = eic.getResponseMessageContext();
                 org.apache.axis2.context.MessageContext axisResponseMsgCtx =
                         responseMsgCtx.getAxisMessageContext();
-
+                if (loader != null) {
+                    responseMsgCtx.setProperty(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
+                            loader);
+                }
                 MessageUtils.putMessageOnMessageContext(responseMsgCtx.getMessage(),
                                                         axisResponseMsgCtx);
 
@@ -269,4 +260,7 @@
         eic.setInvocationListenerFactories(InvocationListenerRegistry.getFactories());
     }
 
+    public ClassLoader getCachedClassLoader(org.apache.axis2.context.MessageContext msgContext)
{
+        return (ClassLoader) msgContext.getAxisService().getParameterValue(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER);
+    }
 }



---------------------------------------------------------------------
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