aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-09-03 10:07:22 +0300
committerLeif Åstrand <leif@vaadin.com>2013-09-03 10:07:22 +0300
commitce110b8b060d7c215f69a7e03c24ca80d88da037 (patch)
treeb4209253abf876db9d2233abdba945ae96ae28a8 /uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java
parent261a3ba76a523d7e8d6b717f6f9d67eaef8c901f (diff)
parent11cdf93fedc9e693468d25092afba8172ce8ebf0 (diff)
downloadvaadin-framework-ce110b8b060d7c215f69a7e03c24ca80d88da037.tar.gz
vaadin-framework-ce110b8b060d7c215f69a7e03c24ca80d88da037.zip
Merge changes from origin/7.1
d8b0b50 Always unlock the same session instance that was locked (#12481) e6af0f0 Avoid leaking memory from inherited ThreadLocales. Fixes #12401 f7ee8fb Updated _trackMessageSize based on latest upstream version (#12468) a24d391 Table ignores Container updates while painting (#12258) 7068d78 The colon in the calendar event caption is now also hideable. Fixes #12460 61dd8f7 Corrected typo in version variable (#12440) 476e0b8 Changed 'feature release' text to maintenance release (#12486) faa2569 Updated browser versions 831747a Fix regression where empty RTA returns <br> (#12490) cb8df75 Add deprecation message to unused constant 4c5bb0e Sets the locale in the test case. #12460 11cdf93 Excludes WeakValueMap from the serializable test #12401 Change-Id: Id7eeba06d14518c254ceb01e38e2441967932755
Diffstat (limited to 'uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java')
-rw-r--r--uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java b/uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java
new file mode 100644
index 0000000000..5ffc7141af
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/performance/ThreadMemoryLeaksTest.java
@@ -0,0 +1,57 @@
+package com.vaadin.tests.performance;
+
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+
+public class ThreadMemoryLeaksTest extends AbstractTestUI {
+
+ public static class Worker {
+ long value = 0;
+ private TimerTask task = new TimerTask() {
+ @Override
+ public void run() {
+ value++;
+ }
+ };
+ private final Timer timer = new Timer(true);
+
+ public Worker() {
+ timer.scheduleAtFixedRate(task, new Date(), 1000);
+ }
+ }
+
+ int workers = 0;
+ Label label;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ label = new Label(String.format("%d workers", workers));
+ addComponent(label);
+ addComponent(new Button("Add worker", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ new Worker();
+ workers++;
+ label.setValue(String.format("%d workers", workers));
+ }
+ }));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Inherited ThreadLocals should not leak memory. Clicking the "
+ + "button starts a new thread, after which memory consumption "
+ + "can be checked with visualvm";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12401;
+ }
+}