diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-11-22 13:31:02 +0200 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-11-23 17:00:30 +0200 |
commit | 3aa137c3aff923b5e9f0b0714a595f29165e423a (patch) | |
tree | d2067b2733e4cbbd8234073a168aaa6ab1abf212 /uitest | |
parent | 2a8435ee61c0f5e70691b2b1a01305f60ef4f67b (diff) | |
download | vaadin-framework-3aa137c3aff923b5e9f0b0714a595f29165e423a.tar.gz vaadin-framework-3aa137c3aff923b5e9f0b0714a595f29165e423a.zip |
Refactor heartbeat handling and inactive UI/session closing (#10252)
* Package-private VaadinService.cleanupSession() handles these, called from VaadinServlet and VaadinPortlet at the end of a request
* UI detach() called when removing from the session (#9755)
* UIs can be explicitly closed; UIs marked as closed are removed at the end of the request (#10249)
* Remove UI cleanup events and listeners in favor of detach events (#10251)
Change-Id: I1f994c43bd2fc5fe7f99f7152c9db35927235291
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/integration/ProxyTest.java | 4 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/minitutorials/v7b2/CleanupUI.java | 22 |
2 files changed, 14 insertions, 12 deletions
diff --git a/uitest/src/com/vaadin/tests/integration/ProxyTest.java b/uitest/src/com/vaadin/tests/integration/ProxyTest.java index 97a4efe90e..36532307fb 100644 --- a/uitest/src/com/vaadin/tests/integration/ProxyTest.java +++ b/uitest/src/com/vaadin/tests/integration/ProxyTest.java @@ -64,9 +64,9 @@ public class ProxyTest extends AbstractTestUI { stopButton.setEnabled(false); startButton.setDisableOnClick(true); - addCleanupListener(new CleanupListener() { + addDetachListener(new DetachListener() { @Override - public void cleanup(CleanupEvent event) { + public void detach(DetachEvent event) { if (server != null && server.isRunning()) { try { server.stop(); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b2/CleanupUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7b2/CleanupUI.java index 9e89d65811..4e70748985 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b2/CleanupUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b2/CleanupUI.java @@ -16,32 +16,34 @@ package com.vaadin.tests.minitutorials.v7b2; +import com.vaadin.server.ClientConnector.DetachListener; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.UI; -public class CleanupUI extends UI implements UI.CleanupListener { +public class CleanupUI extends UI implements DetachListener { @Override protected void init(VaadinRequest request) { - addCleanupListener(new UI.CleanupListener() { + addDetachListener(new DetachListener() { @Override - public void cleanup(UI.CleanupEvent event) { + public void detach(DetachEvent event) { releaseSomeResources(); } }); // ... - addCleanupListener(this); + addDetachListener(this); + } + + @Override + public void detach(DetachEvent event) { + releaseMoreResources(); } private void releaseSomeResources() { // ... } - @Override - public void cleanup(UI.CleanupEvent event) { - // do cleanup - event.getUI(); - // or equivalent: - UI.getCurrent(); + private void releaseMoreResources() { + // ... } } |