cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1302998 - /cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Date Tue, 20 Mar 2012 17:01:47 GMT
Author: dkulp
Date: Tue Mar 20 17:01:47 2012
New Revision: 1302998

URL: http://svn.apache.org/viewvc?rev=1302998&view=rev
Log:
[CXF-4123, CXF-4185] When using a global registry (OSGi), the servlet
should not destroy the registry when refreshed.

Modified:
    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/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=1302998&r1=1302997&r2=1302998&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 Mar 20 17:01:47 2012
@@ -41,6 +41,7 @@ public class CXFNonSpringServlet extends
 
     private static final long serialVersionUID = -2437897227486327166L;
     private DestinationRegistry destinationRegistry;
+    private boolean globalRegistry;
     private Bus bus;
     private ServletController controller;
     private ClassLoader loader;
@@ -55,6 +56,7 @@ public class CXFNonSpringServlet extends
     public CXFNonSpringServlet(DestinationRegistry destinationRegistry,
                                boolean loadBus) {
         this.destinationRegistry = destinationRegistry;
+        this.globalRegistry = destinationRegistry != null;
         this.loadBus = loadBus;
     }
 
@@ -134,15 +136,18 @@ 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();
+        if (!globalRegistry) {
+            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;
         }
-        destinationRegistry = null;
         destroyBus();
     }
     



Mime
View raw message