Author: dkulp
Date: Tue Jun  7 16:02:59 2011
New Revision: 1133061

URL: http://svn.apache.org/viewvc?rev=1133061&view=rev
Log:
Merged revisions 1132762 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1132762 | dkulp | 2011-06-06 16:50:28 -0400 (Mon, 06 Jun 2011) | 1 line
  
  LocalTransportFactory isn't thread safe
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    
cxf/branches/2.3.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
    
cxf/branches/2.3.x-fixes/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=1133061&r1=1133060&r2=1133061&view=diff
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
 (original)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
 Tue Jun  7 16:02:59 2011
@@ -173,7 +173,7 @@ public class WSDLServiceBuilder {
         return buildServices(d, name, null, null);
     }
     public List<ServiceInfo> buildServices(Definition d, QName name, QName 
endpointName) {
-        return buildServices(d, name, endpointName);
+        return buildServices(d, name, endpointName, null);
     }
 
     private List<ServiceInfo> buildServices(Definition d, 

Modified: 
cxf/branches/2.3.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java?rev=1133061&r1=1133060&r2=1133061&view=diff
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
 (original)
+++ 
cxf/branches/2.3.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalTransportFactory.java
 Tue Jun  7 16:02:59 2011
@@ -21,11 +21,13 @@ package org.apache.cxf.transport.local;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
 import javax.annotation.Resource;
@@ -42,6 +44,7 @@ import org.apache.cxf.transport.Destinat
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.http.AddressType;
 
 public class LocalTransportFactory extends AbstractTransportFactory
     implements DestinationFactory, ConduitInitiator {
@@ -54,12 +57,15 @@ public class LocalTransportFactory exten
 
     private static final Logger LOG = 
LogUtils.getL7dLogger(LocalTransportFactory.class);
     private static final Set<String> URI_PREFIXES = new HashSet<String>();
+    private static final String NULL_ADDRESS 
+        = LocalTransportFactory.class.getName() + ".nulladdress";
 
     static {
         URI_PREFIXES.add("local://");
     }
     
-    private Map<String, Destination> destinations = new HashMap<String, 
Destination>();
+    private ConcurrentMap<String, Destination> destinations 
+        = new ConcurrentHashMap<String, Destination>();
 
     private Set<String> messageFilterProperties;
     private Set<String> messageIncludeProperties;
@@ -94,10 +100,21 @@ public class LocalTransportFactory exten
     protected Destination getDestination(EndpointInfo ei,
                                          EndpointReferenceType reference)
         throws IOException {
-        Destination d = destinations.get(reference.getAddress().getValue());
+        Destination d = null;
+        String addr = reference.getAddress().getValue();
+        if (addr == null) {
+            AddressType tp = ei.getExtensor(AddressType.class);
+            if (tp != null) {
+                addr = tp.getLocation();
+            }
+        }
+        if (addr == null) {
+            addr = NULL_ADDRESS;
+        }
+        d = destinations.get(addr);
         if (d == null) {
             d = createDestination(ei, reference);
-            destinations.put(reference.getAddress().getValue(), d);
+            destinations.put(addr, d);
         }
         return d;
     }
@@ -108,7 +125,11 @@ public class LocalTransportFactory exten
     }
 
     void remove(LocalDestination destination) {
-        destinations.remove(destination);
+        for (Map.Entry<String, Destination> e : destinations.entrySet())  {
+            if (e.getValue() == destination) {
+                destinations.remove(e.getKey());
+            }
+        }
     }
 
     public Conduit getConduit(EndpointInfo ei) throws IOException {

Modified: 
cxf/branches/2.3.x-fixes/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java?rev=1133061&r1=1133060&r2=1133061&view=diff
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
 (original)
+++ 
cxf/branches/2.3.x-fixes/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
 Tue Jun  7 16:02:59 2011
@@ -31,7 +31,6 @@ import org.apache.cxf.service.model.Endp
 import org.apache.cxf.transport.Conduit;
 
 import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.wsdl.http.AddressType;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -50,9 +49,7 @@ public class LocalTransportFactoryTest e
         LocalTransportFactory factory = new LocalTransportFactory();
         
         EndpointInfo ei = new EndpointInfo(null, 
"http://schemas.xmlsoap.org/soap/http";);
-        AddressType a = new AddressType();
-        a.setLocation("http://localhost/test";);
-        ei.addExtensor(a);
+        ei.setAddress("http://localhost/test";);
 
         LocalDestination d = (LocalDestination) factory.getDestination(ei);
         d.setMessageObserver(new EchoObserver());


Reply via email to