felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1056877 - in /felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal: handler/HandlerRegistry.java service/HttpServiceImpl.java
Date Sun, 09 Jan 2011 03:18:39 GMT
Author: fmeschbe
Date: Sun Jan  9 03:18:29 2011
New Revision: 1056877

URL: http://svn.apache.org/viewvc?rev=1056877&view=rev
Log:
FELIX-2394 Do not destroy any filters and servlets still registered with the HttpService when
the service is ungotten before the servlets/filters have been unregistered.

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java?rev=1056877&r1=1056876&r2=1056877&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
Sun Jan  9 03:18:29 2011
@@ -80,22 +80,28 @@ public final class HandlerRegistry
         updateFilterArray();
     }
 
-    public synchronized void removeServlet(Servlet servlet)
+    public synchronized void removeServlet(Servlet servlet, final boolean destroy)
     {
         ServletHandler handler = this.servletMap.remove(servlet);
         if (handler != null) {
             updateServletArray();
             this.aliasMap.remove(handler.getAlias());
-            handler.destroy();
+            if (destroy)
+            {
+                handler.destroy();
+            }
         }
     }
 
-    public synchronized void removeFilter(Filter filter)
+    public synchronized void removeFilter(Filter filter, final boolean destroy)
     {
         FilterHandler handler = this.filterMap.remove(filter);
         if (handler != null) {
             updateFilterArray();
-            handler.destroy();
+            if (destroy)
+            {
+                handler.destroy();
+            }
         }
     }
 

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java?rev=1056877&r1=1056876&r2=1056877&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
Sun Jan  9 03:18:29 2011
@@ -71,18 +71,12 @@ public final class HttpServiceImpl
 
     public void unregisterFilter(Filter filter)
     {
-        if (filter != null) {
-            this.handlerRegistry.removeFilter(filter);
-            this.localFilters.remove(filter);
-        }
+        unregisterFilter(filter, true);
     }
 
     public void unregisterServlet(Servlet servlet)
     {
-        if (servlet != null) {
-            this.handlerRegistry.removeServlet(servlet);
-            this.localServlets.remove(servlet);
-        }
+        unregisterServlet(servlet, true);
     }
 
     public void registerServlet(String alias, Servlet servlet, Dictionary initParams, HttpContext
context)
@@ -129,12 +123,28 @@ public final class HttpServiceImpl
     {
         HashSet<Servlet> servlets = new HashSet<Servlet>(this.localServlets);
         for (Servlet servlet : servlets) {
-            unregisterServlet(servlet);
+            unregisterServlet(servlet, false);
         }
 
         HashSet<Filter> filters = new HashSet<Filter>(this.localFilters);
         for (Filter fiter : filters) {
-            unregisterFilter(fiter);
+            unregisterFilter(fiter, false);
+        }
+    }
+
+    private void unregisterFilter(Filter filter, final boolean destroy)
+    {
+        if (filter != null) {
+            this.handlerRegistry.removeFilter(filter, destroy);
+            this.localFilters.remove(filter);
+        }
+    }
+
+    private void unregisterServlet(Servlet servlet, final boolean destroy)
+    {
+        if (servlet != null) {
+            this.handlerRegistry.removeServlet(servlet, destroy);
+            this.localServlets.remove(servlet);
         }
     }
 



Mime
View raw message