diff options
author | Artur Signell <artur@vaadin.com> | 2014-02-21 22:07:24 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-02-22 01:22:32 +0200 |
commit | badf9f27dac3457c797a07bb383a6f30088c336b (patch) | |
tree | 84ff0541d2bdbd134ff15d648ffaa30f394af038 /server | |
parent | bce95bce91f80ddd228c96ab7b89770499b5e49e (diff) | |
download | vaadin-framework-badf9f27dac3457c797a07bb383a6f30088c336b.tar.gz vaadin-framework-badf9f27dac3457c797a07bb383a6f30088c336b.zip |
Do not prevent deployment if Atmosphere init fails (#13199)
Change-Id: I07e23bcdea6b2bd23a37651a804a537690fb1311
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/VaadinServletService.java | 21 | ||||
-rw-r--r-- | server/src/com/vaadin/server/communication/PushRequestHandler.java | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/server/src/com/vaadin/server/VaadinServletService.java b/server/src/com/vaadin/server/VaadinServletService.java index 818f2e87c6..daefad0644 100644 --- a/server/src/com/vaadin/server/VaadinServletService.java +++ b/server/src/com/vaadin/server/VaadinServletService.java @@ -37,7 +37,7 @@ import com.vaadin.ui.UI; public class VaadinServletService extends VaadinService { private final VaadinServlet servlet; - private final static boolean atmosphereAvailable = checkAtmosphereSupport(); + private boolean atmosphereAvailable = checkAtmosphereSupport(); /** * Keeps track of whether a warning about missing push support has already @@ -66,11 +66,13 @@ public class VaadinServletService extends VaadinService { private static boolean checkAtmosphereSupport() { try { String rawVersion = Version.getRawVersion(); - if (!Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION.equals(rawVersion)) { + if (!Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION + .equals(rawVersion)) { getLogger().log( Level.WARNING, Constants.INVALID_ATMOSPHERE_VERSION_WARNING, - new Object[] { Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION, + new Object[] { + Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION, rawVersion }); } return true; @@ -86,7 +88,18 @@ public class VaadinServletService extends VaadinService { handlers.add(0, new ServletBootstrapHandler()); handlers.add(new ServletUIInitHandler()); if (atmosphereAvailable) { - handlers.add(new PushRequestHandler(this)); + try { + handlers.add(new PushRequestHandler(this)); + } catch (ServiceException e) { + // Atmosphere init failed. Push won't work but we don't throw a + // service exception as we don't want to prevent non-push + // applications from working + getLogger() + .log(Level.WARNING, + "Error initializing Atmosphere. Push will not work.", + e); + atmosphereAvailable = false; + } } return handlers; } diff --git a/server/src/com/vaadin/server/communication/PushRequestHandler.java b/server/src/com/vaadin/server/communication/PushRequestHandler.java index aff07d96d7..272dd8e05c 100644 --- a/server/src/com/vaadin/server/communication/PushRequestHandler.java +++ b/server/src/com/vaadin/server/communication/PushRequestHandler.java @@ -104,7 +104,7 @@ public class PushRequestHandler implements RequestHandler, trackMessageSize.configure(atmosphere.getAtmosphereConfig()); atmosphere.interceptor(trackMessageSize); } catch (ServletException e) { - throw new ServiceException("Could not read atmosphere settings", e); + throw new ServiceException("Atmosphere init failed", e); } } |