]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make checkAtmosphereSupport() non-static (#12131) (#12159)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Wed, 2 Dec 2020 04:42:06 +0000 (06:42 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Dec 2020 04:42:06 +0000 (06:42 +0200)
Fixes: https://github.com/vaadin/multiplatform-runtime/issues/77
Authored-by: Tatu Lund <tatu@vaadin.com>
server/src/main/java/com/vaadin/server/VaadinService.java

index 4f018208682c21e33e781d0ed9716aaf0c4623f1..31ddf7b8bafea1c619910991a2aaac9549a03604 100644 (file)
@@ -145,7 +145,7 @@ public abstract class VaadinService implements Serializable {
     private Iterable<DependencyFilter> dependencyFilters;
     private ConnectorIdGenerator connectorIdGenerator;
 
-    private boolean atmosphereAvailable = checkAtmosphereSupport();
+    private Boolean atmosphereAvailable = null;
 
     /**
      * Keeps track of whether a warning about missing push support has already
@@ -1853,7 +1853,7 @@ public abstract class VaadinService implements Serializable {
      *         is not available.
      */
     public boolean ensurePushAvailable() {
-        if (atmosphereAvailable) {
+        if (isAtmosphereAvailable()) {
             return true;
         } else {
             if (!pushWarningEmitted) {
@@ -1865,7 +1865,7 @@ public abstract class VaadinService implements Serializable {
         }
     }
 
-    private static boolean checkAtmosphereSupport() {
+    private boolean checkAtmosphereSupport() {
         String rawVersion = AtmospherePushConnection.getAtmosphereVersion();
         if (rawVersion == null) {
             return false;
@@ -1888,6 +1888,9 @@ public abstract class VaadinService implements Serializable {
      * @return true if Atmosphere is available, false otherwise
      */
     protected boolean isAtmosphereAvailable() {
+        if (atmosphereAvailable == null) {
+            atmosphereAvailable = checkAtmosphereSupport();
+        }
         return atmosphereAvailable;
     }