cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1148235 - in /cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport: http/AbstractHTTPDestination.java servlet/CXFNonSpringServlet.java
Date Tue, 19 Jul 2011 08:41:37 GMT
Author: ay
Date: Tue Jul 19 08:41:37 2011
New Revision: 1148235

URL: http://svn.apache.org/viewvc?rev=1148235&view=rev
Log:
[CXF-3665] server-side endpoint cleanup problem under spring/osgi

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1148235&r1=1148234&r2=1148235&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Tue Jul 19 08:41:37 2011
@@ -100,7 +100,7 @@ public abstract class AbstractHTTPDestin
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractHTTPDestination.class);
     
     protected final Bus bus;
-    protected final DestinationRegistry registry;
+    protected DestinationRegistry registry;
     protected final String path;
 
     // Configuration values
@@ -732,10 +732,20 @@ public abstract class AbstractHTTPDestin
     public boolean canAssert(QName type) {
         return PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME.equals(type); 
     }
+    
+    public void releaseRegistry() {
+        registry = null;
+    }
+    
 
     @Override
     public void shutdown() {
-        registry.removeDestination(path);
+        synchronized (this) {
+            if (registry != null) {
+                registry.removeDestination(path);
+                releaseRegistry();
+            }
+        }
         super.shutdown();
     }
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=1148235&r1=1148234&r2=1148235&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Tue Jul 19 08:41:37 2011
@@ -30,6 +30,7 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
 import org.apache.cxf.transport.servlet.servicelist.ServiceListGeneratorServlet;
@@ -117,4 +118,15 @@ public class CXFNonSpringServlet extends
         }
     }
 
+    public void destroy() {
+        for (String path : destinationRegistry.getDestinationsPaths()) {
+            // clean up the destination in case the destination itself can no longer access
the registry later
+            AbstractHTTPDestination dest = destinationRegistry.getDestinationForPath(path);
+            synchronized (dest) {
+                destinationRegistry.removeDestination(path);
+                dest.releaseRegistry();
+            }
+        }
+        destinationRegistry = null;
+    }
 }



Mime
View raw message