cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1303012 - /cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Date Tue, 20 Mar 2012 17:14:36 GMT
Author: dkulp
Date: Tue Mar 20 17:14:36 2012
New Revision: 1303012

URL: http://svn.apache.org/viewvc?rev=1303012&view=rev
Log:
Merged revisions 1302998 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1302998 | dkulp | 2012-03-20 13:01:47 -0400 (Tue, 20 Mar 2012) | 3 lines

  [CXF-4123, CXF-4185] When using a global registry (OSGi), the servlet
  should not destroy the registry when refreshed.

........

Modified:
    cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java

Modified: cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=1303012&r1=1303011&r2=1303012&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Tue Mar 20 17:14:36 2012
@@ -40,6 +40,7 @@ import org.apache.cxf.transport.servlet.
 public class CXFNonSpringServlet extends AbstractHTTPServlet {
 
     private DestinationRegistry destinationRegistry;
+    private boolean globalRegistry;
     private Bus bus;
     private ServletController controller;
     private ClassLoader loader;
@@ -54,6 +55,7 @@ public class CXFNonSpringServlet extends
     public CXFNonSpringServlet(DestinationRegistry destinationRegistry,
                                boolean loadBus) {
         this.destinationRegistry = destinationRegistry;
+        this.globalRegistry = destinationRegistry != null;
         this.loadBus = loadBus;
     }
 
@@ -133,15 +135,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