diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-22 14:49:22 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-22 15:03:57 +0300 |
commit | 2adfd3e94a914c8206c9a4b1c19ff7a051edf0d8 (patch) | |
tree | ef343d97c68da356ce2c32343086b940ceec3141 /server/src/com/vaadin/Application.java | |
parent | 7a8fd7b5c0223ef6820b4e5cdbe1c05578b17d4a (diff) | |
download | vaadin-framework-2adfd3e94a914c8206c9a4b1c19ff7a051edf0d8.tar.gz vaadin-framework-2adfd3e94a914c8206c9a4b1c19ff7a051edf0d8.zip |
Improve documentation, disable cleanup if heartbeat interval nonpositive, change default heartbeat interval from 500 to 300, some logging on client side (#9265)
Diffstat (limited to 'server/src/com/vaadin/Application.java')
-rw-r--r-- | server/src/com/vaadin/Application.java | 23 |
1 files changed, 14 insertions, 9 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 |