From: Artur Signell Date: Thu, 18 Dec 2014 07:19:21 +0000 (+0200) Subject: Revert "Workaround for Atmosphere race condition (#13528)" (#14534) X-Git-Tag: 7.4.0.beta1~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d80220da2c88591a3a767f9693ec5ceb460724bd;p=vaadin-framework.git Revert "Workaround for Atmosphere race condition (#13528)" (#14534) This reverts commit 7f9ea1c9159c8362e6a309b630cbb59a4dae72dd. The problem is fixed in Atmosphere 2.2 Conflicts: server/src/com/vaadin/server/communication/PushRequestHandler.java Change-Id: I04a1b0c87927beb9b2048fee1ec95cd17af53a28 --- diff --git a/server/src/com/vaadin/server/communication/PushRequestHandler.java b/server/src/com/vaadin/server/communication/PushRequestHandler.java index b1a8ea25a7..40eb1b688e 100644 --- a/server/src/com/vaadin/server/communication/PushRequestHandler.java +++ b/server/src/com/vaadin/server/communication/PushRequestHandler.java @@ -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); } }