summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-08-22 14:49:22 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-08-22 15:03:57 +0300
commit2adfd3e94a914c8206c9a4b1c19ff7a051edf0d8 (patch)
treeef343d97c68da356ce2c32343086b940ceec3141 /client
parent7a8fd7b5c0223ef6820b4e5cdbe1c05578b17d4a (diff)
downloadvaadin-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 'client')
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java4
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java16
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);