diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java | 4 | ||||
-rw-r--r-- | client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index c3bf3f8b44..2771871653 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -290,6 +290,10 @@ public class ApplicationConfiguration implements EntryPoint { return rootId; } + /** + * @return The interval in seconds between heartbeat requests, or a + * non-positive number if heartbeat is disabled. + */ public int getHeartbeatInterval() { return heartbeatInterval; } diff --git a/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index d2deb70190..cd90403139 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -2524,19 +2524,23 @@ public class ApplicationConnection { } /** - * Schedules a heartbeat request. + * Schedules a heartbeat request to occur after the configured heartbeat + * interval elapses if the interval is a positive number. Otherwise, does + * nothing. * * @see #sendHeartbeat() + * @see ApplicationConfiguration#getHeartbeatInterval() */ - private void scheduleHeartbeat() { - final int interval = 1000 * getConfiguration().getHeartbeatInterval(); + protected void scheduleHeartbeat() { + final int interval = getConfiguration().getHeartbeatInterval(); if (interval > 0) { + VConsole.log("Scheduling heartbeat in " + interval + " seconds"); new Timer() { @Override public void run() { sendHeartbeat(); } - }.schedule(interval); + }.schedule(interval * 1000); } } @@ -2552,7 +2556,7 @@ public class ApplicationConnection { * @see #scheduleHeartbeat() * @see com.vaadin.ui.Root#heartbeat() */ - private void sendHeartbeat() { + protected void sendHeartbeat() { final String uri = addGetParameters( translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX + ApplicationConstants.HEARTBEAT_REQUEST_PATH), @@ -2568,6 +2572,7 @@ public class ApplicationConnection { int status = response.getStatusCode(); if (status == Response.SC_OK) { // TODO Permit retry in some error situations + VConsole.log("Heartbeat response OK"); scheduleHeartbeat(); } else { VConsole.error("Heartbeat request failed with status code " @@ -2585,6 +2590,7 @@ public class ApplicationConnection { rb.setCallback(callback); try { + VConsole.log("Sending heartbeat request..."); rb.send(); } catch (RequestException re) { callback.onError(null, re); |