Initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.example.leakdemo;
|
||||
|
||||
import com.vaadin.flow.component.Component;
|
||||
import com.vaadin.flow.component.html.H2;
|
||||
import com.vaadin.flow.component.html.Paragraph;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.router.Route;
|
||||
|
||||
/** LEAK: the view of one user keeps a reference to a view of a different user. */
|
||||
@Route("snoop")
|
||||
public class SnoopView extends VerticalLayout {
|
||||
|
||||
private Component peeked;
|
||||
|
||||
public SnoopView() {
|
||||
add(new H2("Snoop"));
|
||||
synchronized (StaticLeakView.RECENT_VIEWS) {
|
||||
if (!StaticLeakView.RECENT_VIEWS.isEmpty()) {
|
||||
peeked = StaticLeakView.RECENT_VIEWS.get(0);
|
||||
}
|
||||
}
|
||||
add(new Paragraph(peeked == null ? "nothing to peek at" : "peeking at " + peeked.getClass().getSimpleName()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user