]> source.dussan.org Git - vaadin-framework.git/commitdiff
Close PushRequestHandler when VaadinServlet is destroyed (#11878)
authorLeif Åstrand <leif@vaadin.com>
Fri, 19 Jul 2013 11:36:56 +0000 (14:36 +0300)
committerLeif Åstrand <leif@vaadin.com>
Fri, 19 Jul 2013 11:36:56 +0000 (14:36 +0300)
Should be implemented using ServiceDestoryListener in Vaadin 7.2

Merge: no

Change-Id: Ibb4d37f1f95c56b80111df3a3217076af18dd93d

server/src/com/vaadin/server/VaadinServlet.java

index 803a903341373e92408112dc3ad50a7e091fcd62..c16be33de2312c5bfae1c53a0c0ec5115338df1c 100644 (file)
@@ -43,6 +43,7 @@ import javax.servlet.http.HttpServletResponse;
 import com.vaadin.annotations.VaadinServletConfiguration;
 import com.vaadin.annotations.VaadinServletConfiguration.InitParameterName;
 import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.server.communication.PushRequestHandler;
 import com.vaadin.server.communication.ServletUIInitHandler;
 import com.vaadin.shared.JsonConstants;
 import com.vaadin.ui.UI;
@@ -1076,6 +1077,17 @@ public class VaadinServlet extends HttpServlet implements Constants {
         return u;
     }
 
+    @Override
+    public void destroy() {
+        super.destroy();
+
+        for (RequestHandler handler : getService().getRequestHandlers()) {
+            if (handler instanceof PushRequestHandler) {
+                ((PushRequestHandler) handler).destroy();
+            }
+        }
+    }
+
     /**
      * Escapes characters to html entities. An exception is made for some
      * "safe characters" to keep the text somewhat readable.