diff options
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r-- | server/src/com/vaadin/ui/ConnectorTracker.java | 11 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index bd66f3b368..85cdcdf65c 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -32,9 +32,9 @@ import org.json.JSONException; import org.json.JSONObject; import com.vaadin.server.AbstractClientConnector; -import com.vaadin.server.LegacyCommunicationManager; import com.vaadin.server.ClientConnector; import com.vaadin.server.GlobalResourceHandler; +import com.vaadin.server.LegacyCommunicationManager; import com.vaadin.server.StreamVariable; /** @@ -465,6 +465,15 @@ public class ConnectorTracker implements Serializable { } /** + * Checks if there a dirty connectors. + * + * @return true if there are dirty connectors, false otherwise + */ + public boolean hasDirtyConnectors() { + return !getDirtyConnectors().isEmpty(); + } + + /** * Returns a collection of those {@link #getDirtyConnectors() dirty * connectors} that are actually visible to the client. * diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 162d072222..6b906b8eab 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -1141,6 +1141,11 @@ public abstract class UI extends AbstractSingleComponentContainer implements public void push() { VaadinSession session = getSession(); if (session != null) { + if (getConnectorTracker().hasDirtyConnectors()) { + // Do not push if there is nothing to push + return; + } + if (session.getPushMode() == PushMode.DISABLED) { throw new IllegalStateException("Push not enabled"); } |