]> source.dussan.org Git - vaadin-framework.git/commitdiff
Revert "Workaround for Atmosphere race condition (#13528)" (#14534)
authorArtur Signell <artur@vaadin.com>
Thu, 18 Dec 2014 07:19:21 +0000 (09:19 +0200)
committerVaadin Code Review <review@vaadin.com>
Thu, 18 Dec 2014 08:38:08 +0000 (08:38 +0000)
This reverts commit 7f9ea1c9159c8362e6a309b630cbb59a4dae72dd.
The problem is fixed in Atmosphere 2.2

Conflicts:
server/src/com/vaadin/server/communication/PushRequestHandler.java

Change-Id: I04a1b0c87927beb9b2048fee1ec95cd17af53a28

server/src/com/vaadin/server/communication/PushRequestHandler.java

index b1a8ea25a7e5807bf3f7cc5f12497cd03283ba1e..40eb1b688e6be19c3e8dfd5d3b0c13ebe683a184 100644 (file)
@@ -58,12 +58,6 @@ public class PushRequestHandler implements RequestHandler,
     private AtmosphereFramework atmosphere;
     private PushHandler pushHandler;
 
-    /**
-     * Atmosphere 2.x has a race condition when AtmosphereFramework init(config)
-     * is run from two threads at once. See http://dev.vaadin.com/ticket/13528
-     */
-    private static Object atmosphereInitRaceConditionWorkaroundLock = new Object();
-
     public PushRequestHandler(VaadinServletService service)
             throws ServiceException {
 
@@ -93,48 +87,46 @@ public class PushRequestHandler implements RequestHandler,
             }
         });
 
-        synchronized (atmosphereInitRaceConditionWorkaroundLock) {
-            pushHandler = new PushHandler(service);
-            atmosphere.addAtmosphereHandler("/*", pushHandler.handler);
-            atmosphere.addInitParameter(ApplicationConfig.BROADCASTER_CACHE,
-                    UUIDBroadcasterCache.class.getName());
-            atmosphere.addInitParameter(
-                    ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true");
-            atmosphere.addInitParameter(ApplicationConfig.MESSAGE_DELIMITER,
-                    String.valueOf(PushConstants.MESSAGE_DELIMITER));
-
-            // Disable heartbeat (it does not emit correct events client side)
-            // https://github.com/Atmosphere/atmosphere-javascript/issues/141
-            atmosphere.addInitParameter(
-                    ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTORS,
-                    HeartbeatInterceptor.class.getName());
-
-            final String bufferSize = String
-                    .valueOf(PushConstants.WEBSOCKET_BUFFER_SIZE);
-            atmosphere.addInitParameter(
-                    ApplicationConfig.WEBSOCKET_BUFFER_SIZE, bufferSize);
-            atmosphere.addInitParameter(
-                    ApplicationConfig.WEBSOCKET_MAXTEXTSIZE, bufferSize);
-            atmosphere.addInitParameter(
-                    ApplicationConfig.WEBSOCKET_MAXBINARYSIZE, bufferSize);
-            atmosphere.addInitParameter(
-                    ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL,
-                    "false");
-            // Disable Atmosphere's message about commercial support
-            atmosphere.addInitParameter(
-                    "org.atmosphere.cpr.showSupportMessage", "false");
-
-            try {
-                atmosphere.init(vaadinServletConfig);
-
-                // Ensure the client-side knows how to split the message stream
-                // into individual messages when using certain transports
-                AtmosphereInterceptor trackMessageSize = new TrackMessageSizeInterceptor();
-                trackMessageSize.configure(atmosphere.getAtmosphereConfig());
-                atmosphere.interceptor(trackMessageSize);
-            } catch (ServletException e) {
-                throw new ServiceException("Atmosphere init failed", e);
-            }
+        pushHandler = new PushHandler(service);
+        atmosphere.addAtmosphereHandler("/*", pushHandler.handler);
+        atmosphere.addInitParameter(ApplicationConfig.BROADCASTER_CACHE,
+                UUIDBroadcasterCache.class.getName());
+        atmosphere.addInitParameter(ApplicationConfig.PROPERTY_SESSION_SUPPORT,
+                "true");
+        atmosphere.addInitParameter(ApplicationConfig.MESSAGE_DELIMITER,
+                String.valueOf(PushConstants.MESSAGE_DELIMITER));
+
+        // Disable heartbeat (it does not emit correct events client side)
+        // https://github.com/Atmosphere/atmosphere-javascript/issues/141
+        atmosphere.addInitParameter(
+                ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTORS,
+                HeartbeatInterceptor.class.getName());
+
+        final String bufferSize = String
+                .valueOf(PushConstants.WEBSOCKET_BUFFER_SIZE);
+        atmosphere.addInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE,
+                bufferSize);
+        atmosphere.addInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE,
+                bufferSize);
+        atmosphere.addInitParameter(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE,
+                bufferSize);
+        atmosphere.addInitParameter(
+                ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL,
+                "false");
+        // Disable Atmosphere's message about commercial support
+        atmosphere.addInitParameter("org.atmosphere.cpr.showSupportMessage",
+                "false");
+
+        try {
+            atmosphere.init(vaadinServletConfig);
+
+            // Ensure the client-side knows how to split the message stream
+            // into individual messages when using certain transports
+            AtmosphereInterceptor trackMessageSize = new TrackMessageSizeInterceptor();
+            trackMessageSize.configure(atmosphere.getAtmosphereConfig());
+            atmosphere.interceptor(trackMessageSize);
+        } catch (ServletException e) {
+            throw new ServiceException("Atmosphere init failed", e);
         }
     }