]> source.dussan.org Git - vaadin-framework.git/commitdiff
Move call to getMessageHandler().onResynchronize(); to right place (#12178) (#12184)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Fri, 22 Jan 2021 11:49:04 +0000 (13:49 +0200)
committerGitHub <noreply@github.com>
Fri, 22 Jan 2021 11:49:04 +0000 (13:49 +0200)
https://github.com/vaadin/framework/pull/12043 changed resync message sending to be deferred to queue. Now also the setting of the semaphor in message handler needs to be deferred to its right place. Otherwise there is possibility for a timing glitch. I.e. MessageHandler is set to resync handling mode before message is actually send.

Fixes: https://github.com/vaadin/framework/issues/12151
Authored-by: Tatu Lund <tatu@vaadin.com>
client/src/main/java/com/vaadin/client/communication/MessageSender.java
uitest/src/main/java/com/vaadin/tests/push/PushWithPreserveOnRefresh.java

index 9a443adb2ec184786c67fc9dfc8437641941fdbd..969e38ef5d7278ca98d126579a84ce23ad31d536 100644 (file)
@@ -127,6 +127,7 @@ public class MessageSender {
         }
         if (resynchronizeRequested) {
             getLogger().info("Resynchronizing from server");
+            getMessageHandler().onResynchronize();
             extraJson.put(ApplicationConstants.RESYNCHRONIZE_ID, true);
             resynchronizeRequested = false;
         }
@@ -356,7 +357,6 @@ public class MessageSender {
      * state from the server
      */
     public void resynchronize() {
-        getMessageHandler().onResynchronize();
         getLogger().info("Resynchronize from server requested");
         resynchronizeRequested = true;
         sendInvocationsToServer();
index a9b688626a67974d5ba53c400832bc21cfb54d5d..8d870f72bc723de885a74216c8f3fc9136cac5d8 100644 (file)
@@ -3,12 +3,13 @@ package com.vaadin.tests.push;
 import com.vaadin.annotations.PreserveOnRefresh;
 import com.vaadin.annotations.Push;
 import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ui.Transport;
 import com.vaadin.tests.components.AbstractReindeerTestUI;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Label;
 
 @PreserveOnRefresh
-@Push
+@Push(transport = Transport.WEBSOCKET_XHR)
 public class PushWithPreserveOnRefresh extends AbstractReindeerTestUI {
 
     private Log log = new Log(5);
@@ -16,6 +17,7 @@ public class PushWithPreserveOnRefresh extends AbstractReindeerTestUI {
 
     @Override
     protected void setup(VaadinRequest request) {
+        setTheme("valo");
         // Internal parameter sent by vaadinBootstrap.js,
         addComponent(new Label("window.name: " + request.getParameter("v-wn")));
         addComponent(new Label("UI id: " + getUIId()));