diff options
Diffstat (limited to 'server/src/com')
3 files changed, 18 insertions, 12 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 62052cd3b7..d4768abfb4 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -2448,7 +2448,9 @@ public class Application implements Terminal.ErrorListener, Serializable { /** * Removes all those roots from the application whose last heartbeat * occurred more than {@link #getHeartbeatTimeout()} seconds ago. Close - * events are fired for the removed roots. + * events are fired for the removed roots. If + * <code>getHeartbeatTimeout()</code> returns a nonpositive number, no + * cleanup is performed. * <p> * Called by the framework at the end of every request. * @@ -2459,13 +2461,15 @@ public class Application implements Terminal.ErrorListener, Serializable { * @since 7.0.0 */ public void closeInactiveRoots() { - long now = System.currentTimeMillis(); - for (Iterator<Root> i = roots.values().iterator(); i.hasNext();) { - Root root = i.next(); - if (now - root.getLastHeartbeat() > 1000 * getHeartbeatTimeout()) { - i.remove(); - retainOnRefreshRoots.values().remove(root.getRootId()); - root.fireCloseEvent(); + if (getHeartbeatTimeout() > 0) { + long now = System.currentTimeMillis(); + for (Iterator<Root> i = roots.values().iterator(); i.hasNext();) { + Root root = i.next(); + if (now - root.getLastHeartbeat() > 1000 * getHeartbeatTimeout()) { + i.remove(); + retainOnRefreshRoots.values().remove(root.getRootId()); + root.fireCloseEvent(); + } } } } @@ -2478,7 +2482,8 @@ public class Application implements Terminal.ErrorListener, Serializable { * * @since 7.0.0 * - * @return The heartbeat timeout in seconds. + * @return The heartbeat timeout in seconds or a nonpositive number if + * timeout never occurs. */ public int getHeartbeatTimeout() { // Permit three missed heartbeats before closing the root diff --git a/server/src/com/vaadin/terminal/DeploymentConfiguration.java b/server/src/com/vaadin/terminal/DeploymentConfiguration.java index 550bfdb7cf..7d006812b9 100644 --- a/server/src/com/vaadin/terminal/DeploymentConfiguration.java +++ b/server/src/com/vaadin/terminal/DeploymentConfiguration.java @@ -155,7 +155,8 @@ public interface DeploymentConfiguration extends Serializable { public int getResourceCacheTime(); /** - * Returns the number of seconds between heartbeat requests of a root. + * Returns the number of seconds between heartbeat requests of a root, or a + * non-negative number if heartbeat is disabled. * * @return */ diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java b/server/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java index 3e7f1eaf71..d2cc4a2eea 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java @@ -228,11 +228,11 @@ public abstract class AbstractDeploymentConfiguration implements try { heartbeatInterval = Integer .parseInt(getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "500")); + Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300")); } catch (NumberFormatException e) { getLogger().warning( Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC); - heartbeatInterval = 500; + heartbeatInterval = 300; } } |