diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-09-06 15:22:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 15:22:20 +0300 |
commit | 02a666092b881a79934bba8c7b53de830b53a5a4 (patch) | |
tree | fc8cc0338c5e8c64001b061956bb271eebf96e8b /server | |
parent | fac79ef88542358bb161aa7d783f0322501850d6 (diff) | |
download | vaadin-framework-02a666092b881a79934bba8c7b53de830b53a5a4.tar.gz vaadin-framework-02a666092b881a79934bba8c7b53de830b53a5a4.zip |
Fix making components visible by push (#9934)
Fix connector tracker cleanup for the case where a component is
hidden by a request and is made visible again by push.
This fixes a regression caused by #9305.
Fixes #9905
Diffstat (limited to 'server')
3 files changed, 22 insertions, 5 deletions
diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java index 671b35ae66..26b9cfa7a1 100644 --- a/server/src/main/java/com/vaadin/server/VaadinSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinSession.java @@ -1028,7 +1028,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } } try { - ui.getConnectorTracker().cleanConnectorMap(); + ui.getConnectorTracker().cleanConnectorMap(false); } catch (AssertionError | Exception e) { getLogger().log(Level.SEVERE, "Exception while cleaning connector map for ui " diff --git a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java index d27fc3f0ae..92b6e8e8bd 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java @@ -321,6 +321,7 @@ public class UidlWriter implements Serializable { writePerformanceData(ui, writer); } finally { uiConnectorTracker.setWritingResponse(false); + uiConnectorTracker.cleanConnectorMap(true); } } diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index c41c0d0fd5..54fb5c5822 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -71,7 +71,7 @@ public class ConnectorTracker implements Serializable { /** * Connectors that have been unregistered and should be cleaned up the next - * time {@link #cleanConnectorMap()} is invoked unless they have been + * time {@link #cleanConnectorMap(boolean)} is invoked unless they have been * registered again. */ private final Set<ClientConnector> unregisteredConnectors = new HashSet<>(); @@ -264,12 +264,28 @@ public class ConnectorTracker implements Serializable { /** * Cleans the connector map from all connectors that are no longer attached + * to the application if there are dirty connectors or the force flag is + * true. This should only be called by the framework. + * + * @param force + * {@code true} to force cleaning + * @since + */ + public void cleanConnectorMap(boolean force) { + if (force || !dirtyConnectors.isEmpty()) { + cleanConnectorMap(); + } + } + + /** + * Cleans the connector map from all connectors that are no longer attached * to the application. This should only be called by the framework. + * + * @deprecated use {@link #cleanConnectorMap(boolean)} instead */ + @Deprecated public void cleanConnectorMap() { - if (!unregisteredConnectors.isEmpty()) { - removeUnregisteredConnectors(); - } + removeUnregisteredConnectors(); cleanStreamVariables(); |